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.

242 lines
6.8 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 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 line into system clipboard
  126. nnoremap <leader>D "+dd
  127. " delete entire buffer into system clipboard
  128. nnoremap <leader>DA "+ggdG
  129. " reload file
  130. nnoremap <leader>e :e<CR>
  131. " find merge conflicts
  132. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  133. " reload folds
  134. nnoremap <leader>ff :set foldmethod=marker<CR> zM
  135. " toggle search highlighting
  136. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  137. " help
  138. nnoremap <leader>he :help
  139. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  140. nnoremap <leader>vhe :vert help
  141. " move cursor to middle of line
  142. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  143. " don't wrap lines
  144. nnoremap <leader>nw :set nowrap<CR>
  145. " check if in neovim
  146. nnoremap <leader>nv :echo has('nvim')<CR>
  147. " Plug commands
  148. nnoremap <leader>pli :PlugInstall<CR>
  149. nnoremap <leader>plc :PlugClean<CR>
  150. nnoremap <leader>plu :PlugUpdate<CR>
  151. " don't break lines
  152. nnoremap <leader>py :set tw=0<CR>
  153. " replace in next x lines
  154. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  155. " replace in line
  156. nnoremap <leader>rl q:i.s///g<left><left><left>
  157. " reload vim config
  158. nnoremap <leader>rv :source $MYVIMRC<CR>
  159. " replace in entire file
  160. nnoremap <leader>R q:i%s///g<ESC>2F/i
  161. " set syntax to shell (for dotfiles)
  162. nnoremap <leader>s :set syn=sh<CR>
  163. " format current line
  164. nnoremap <leader>w Vgq
  165. " format this and next line
  166. nnoremap <leader>ww Vjgq
  167. " toggle fold
  168. nnoremap <leader>z za
  169. " copy next thing to system clipboard
  170. nnoremap <leader>y "+
  171. nnoremap <leader>Y "+Y
  172. " yank entire buffer
  173. nnoremap <leader>yg ggyG
  174. " }}} leader mappings "
  175. " }}} Mappings "
  176. " Local Mappings {{{ "
  177. let maplocalleader="-"
  178. autocmd Filetype c inoremap <localleader>s struct pixel
  179. " tex {{{ "
  180. autocmd Filetype tex inoremap <localleader>D \Delta
  181. autocmd Filetype tex inoremap <localleader>e \exists
  182. autocmd Filetype tex inoremap <localleader>ep \epsilon
  183. autocmd Filetype tex inoremap <localleader>fa \forall
  184. autocmd Filetype tex inoremap <localleader>g \geq
  185. autocmd Filetype tex inoremap <localleader>i \in
  186. autocmd Filetype tex inoremap <localleader>l \leq
  187. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  188. autocmd Filetype tex inoremap <localleader>n \neg
  189. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  190. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  191. autocmd Filetype tex inoremap <localleader>st such that
  192. autocmd Filetype tex inoremap <localleader>t \times
  193. autocmd Filetype tex inoremap <localleader>T $T$
  194. " replace bars/underscores in URL
  195. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  196. autocmd Filetype tex inoremap <localleader>v \vee
  197. autocmd Filetype tex inoremap <localleader>w \wedge
  198. autocmd Filetype tex inoremap <localleader>x $x$-axis
  199. autocmd Filetype tex inoremap <localleader>y $y$-axis
  200. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  201. " par3
  202. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  203. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  204. " }}} tex "
  205. autocmd Filetype md inoremap <localleader>x 0f[lRX
  206. " }}} Local Mappings "