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.

248 lines
7.0 KiB

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