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.

236 lines
6.6 KiB

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