Dotfiles for my tiling window manager + terminal workflow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
7.6 KiB

7 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. " set x=y {{{ "
  2. au BufWinEnter * set relativenumber
  3. " set background=dark
  4. set background=light
  5. " set t_Co=256
  6. filetype plugin on
  7. syntax on
  8. set tabstop=4
  9. set tw=80
  10. set linebreak
  11. " set colorcolumn=80
  12. set shiftwidth=4
  13. set autoindent
  14. set mouse=c
  15. set clipboard+=unnamedplus
  16. set foldmethod=marker
  17. set linespace=5
  18. " cursor indicator {{{ "
  19. " set listchars=tab:\|\
  20. " set list
  21. " set cursorcolumn
  22. " set cursorline
  23. " }}} cursor indicator "
  24. set timeoutlen=500
  25. set hlsearch
  26. " }}} set x=y "
  27. " commands for file types {{{ "
  28. autocmd VimResized * wincmd =
  29. autocmd BufNewFile,BufRead .* set syntax=sh
  30. autocmd Filetype css,htmldjango,html,tex,txt,markdown set tabstop=2 shiftwidth=2 expandtab
  31. autocmd BufNewFile,BufRead *.md set filetype=markdown
  32. autocmd Filetype markdown set textwidth=0
  33. autocmd BufWritePost key_*.txt !bash ~/linux-config/shortcuts.sh
  34. " }}} commands for file types "
  35. " vim-plug {{{ "
  36. " plug auto-install
  37. if empty(glob('~/.vim/autoload/plug.vim'))
  38. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  39. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  40. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  41. endif
  42. call plug#begin('~/.vim/plugged')
  43. " prequisite for other plugins
  44. Plug 'vim-scripts/L9'
  45. " find files from within Vim
  46. " Plug 'vim-scripts/FuzzyFinder'
  47. " Gotham color scheme
  48. " Plug 'whatyouhide/vim-gotham'
  49. " collection of Vim color schemes
  50. Plug 'flazz/vim-colorschemes'
  51. " preview Vim color scheme easily within Vim
  52. Plug 'xolox/vim-colorscheme-switcher'
  53. " prerequisite for above plugin
  54. Plug 'xolox/vim-misc'
  55. " automatically save buffers upon returning to normal mode
  56. Plug '907th/vim-auto-save'
  57. let g:auto_save = 1
  58. " compile LaTeX PDF while writing the file
  59. " Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
  60. " provides various functionality for writing LaTeX in Vim
  61. Plug 'lervag/vimtex'
  62. au BufWritePost *.tex silent call Tex_RunLaTeX()
  63. au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
  64. let g:vimtex_view_general_viewer = 'zathura'
  65. " auto-completion for various languages
  66. Plug 'Valloric/YouCompleteMe'
  67. " wrote short bits of text that expand into whatever you want
  68. " demo: https://www.youtube.com/watch?v=Zik6u0klD40
  69. Plug 'SirVer/ultisnips'
  70. " better key bindings for UltiSnipsExpandTrigger
  71. let g:UltiSnipsExpandTrigger = "<tab>"
  72. let g:UltiSnipsJumpForwardTrigger = "<tab>"
  73. let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
  74. " custom snippets
  75. Plug 'Kevin-Mok/vim-snippets'
  76. " to make YouCompleteMe work with UltiSnips (both use Tab)
  77. Plug 'ervandew/supertab'
  78. " make YCM compatible with UltiSnips (using supertab)
  79. let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
  80. let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
  81. let g:SuperTabDefaultCompletionType = '<C-n>'
  82. " easily comment/uncomment lines
  83. Plug 'scrooloose/nerdcommenter'
  84. let g:NERDTrimTrailingWhitespace = 1
  85. let g:NERDSpaceDelims = 1
  86. " add quotes/brackets around chunks of text easily
  87. Plug 'tpope/vim-surround'
  88. " navigate around file easily and precisely
  89. Plug 'easymotion/vim-easymotion'
  90. " status bar displaying various info about the current buffer
  91. Plug 'vim-airline/vim-airline'
  92. let g:airline_section_c = '%F'
  93. Plug 'vim-airline/vim-airline-themes'
  94. " continue Markdown lists when started
  95. Plug 'dkarter/bullets.vim'
  96. " coordinate Vim color scheme with terminal color scheme
  97. Plug 'dylanaraps/wal.vim'
  98. " repeat plugin commands
  99. Plug 'tpope/vim-repeat'
  100. " better Django support
  101. Plug 'tweekmonster/django-plus.vim'
  102. " auto-close brackets
  103. Plug 'jiangmiao/auto-pairs'
  104. let g:AutoPairsMapSpace = 0
  105. Plug 'henrik/vim-indexed-search'
  106. call plug#end()
  107. " colorscheme gotham256
  108. colorscheme wal
  109. " }}} vim-plug "
  110. " Mappings {{{ "
  111. " function keys {{{ "
  112. " map <F3> :wa<CR>
  113. map <F4> :wqa<CR>
  114. map <F5> :qa!<CR>
  115. map <F6> :make -C ~/Documents/resume cv<CR>
  116. map <F7> :AutoSaveToggle<CR>
  117. " map <F9> :LLPStartPreview<CR>
  118. map <F9> :VimtexCompile<CR>:VimtexView<CR>
  119. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  120. " }}} function keys "
  121. map <S-Enter> O<ESC>
  122. " splits {{{ "
  123. nnoremap <C-Down> <C-W><C-J>
  124. nnoremap <C-Up> <C-W><C-K>
  125. nnoremap <C-Right> <C-W><C-L>
  126. nnoremap <C-Left> <C-W><C-H>
  127. " Maximize height/width.
  128. nnoremap <C-g> <C-W>_
  129. nnoremap <C-w> <C-W>|
  130. " }}} splits "
  131. " leader mappings {{{ "
  132. let mapleader="\<Space>"
  133. " replace vim-commentary Markdown comments with HTML
  134. nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR>
  135. " delete entire buffer
  136. nnoremap <leader>dg ggdG
  137. " delete line into system clipboard
  138. nnoremap <leader>D "+dd
  139. " delete entire buffer into system clipboard
  140. nnoremap <leader>DA "+ggdG
  141. " reload file
  142. nnoremap <leader>e :e<CR>
  143. " find merge conflicts
  144. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  145. " reload folds
  146. nnoremap <leader>ff :set foldmethod=marker<CR> zM
  147. " toggle search highlighting
  148. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  149. " help
  150. nnoremap <leader>he :help
  151. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  152. nnoremap <leader>vhe :vert help
  153. " move cursor to middle of line
  154. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  155. " don't wrap lines
  156. nnoremap <leader>nw :set nowrap<CR>
  157. " check if in neovim
  158. nnoremap <leader>nv :echo has('nvim')<CR>
  159. " Plug commands
  160. nnoremap <leader>pli :PlugInstall<CR>
  161. nnoremap <leader>plc :PlugClean<CR>
  162. nnoremap <leader>plu :PlugUpdate<CR>
  163. " don't break lines
  164. nnoremap <leader>py :set tw=0<CR>
  165. " replace in next x lines
  166. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  167. " replace in line
  168. nnoremap <leader>rl q:i.s///g<left><left><left>
  169. " reload vim config
  170. nnoremap <leader>rv :source $MYVIMRC<CR>
  171. " replace in entire file
  172. nnoremap <leader>R q:i%s///g<ESC>2F/i
  173. " sort lines
  174. nnoremap <leader>s q:i.,.+sort<ESC>Fsi
  175. " set syntax to shell (for dotfiles)
  176. nnoremap <leader>sh :set syn=sh<CR>
  177. " format current line
  178. nnoremap <leader>w Vgq
  179. " format this and next line
  180. nnoremap <leader>ww Vjgq
  181. " format current 3 lines
  182. nnoremap <leader>www V2jgq
  183. " toggle fold
  184. nnoremap <leader>z za
  185. " copy next thing to system clipboard
  186. nnoremap <leader>y "+
  187. nnoremap <leader>Y "+Y
  188. " yank entire buffer
  189. nnoremap <leader>yg ggyG
  190. " }}} leader mappings "
  191. " }}} Mappings "
  192. " Local Mappings {{{ "
  193. let maplocalleader="-"
  194. autocmd Filetype c inoremap <localleader>s struct pixel
  195. " tex {{{ "
  196. autocmd Filetype tex inoremap <localleader>bt \bowtie
  197. autocmd Filetype tex inoremap <localleader>d \delta
  198. autocmd Filetype tex inoremap <localleader>D \Delta
  199. autocmd Filetype tex inoremap <localleader>e \exists
  200. autocmd Filetype tex inoremap <localleader>ep \epsilon
  201. autocmd Filetype tex inoremap <localleader>fa \forall
  202. autocmd Filetype tex inoremap <localleader>g \geq
  203. autocmd Filetype tex inoremap <localleader>i \in
  204. autocmd Filetype tex inoremap <localleader>l \leq
  205. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  206. " autocmd Filetype tex inoremap <localleader>n \neg
  207. autocmd Filetype tex inoremap <localleader>n \neq
  208. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  209. autocmd Filetype tex inoremap <localleader>q \qquad
  210. autocmd Filetype tex inoremap <localleader>r \Rightarrow
  211. autocmd Filetype tex inoremap <localleader>st such that
  212. autocmd Filetype tex inoremap <localleader>S \Sigma
  213. autocmd Filetype tex inoremap <localleader>t \times
  214. " autocmd Filetype tex inoremap <localleader>T $T$
  215. autocmd Filetype tex inoremap <localleader>T \Theta
  216. " replace bars/underscores in URL
  217. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  218. autocmd Filetype tex inoremap <localleader>v \vee
  219. autocmd Filetype tex inoremap <localleader>w \wedge
  220. autocmd Filetype tex inoremap <localleader>x $x$-axis
  221. autocmd Filetype tex inoremap <localleader>y $y$-axis
  222. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  223. " par3
  224. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  225. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  226. " }}} tex "
  227. autocmd Filetype md inoremap <localleader>x 0f[lRX
  228. " }}} Local Mappings "