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.

254 lines
7.2 KiB

7 years ago
7 years ago
7 years ago
6 years ago
7 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
  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,markdown 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. let g:airline_section_c = '%F'
  88. Plug 'vim-airline/vim-airline-themes'
  89. " continue Markdown lists when started
  90. Plug 'dkarter/bullets.vim'
  91. " coordinate Vim color scheme with terminal color scheme
  92. Plug 'dylanaraps/wal.vim'
  93. " repeat plugin commands
  94. Plug 'tpope/vim-repeat'
  95. " better Django support
  96. Plug 'tweekmonster/django-plus.vim'
  97. " auto-close brackets
  98. Plug 'jiangmiao/auto-pairs'
  99. let g:AutoPairsMapSpace = 0
  100. call plug#end()
  101. " colorscheme gotham256
  102. colorscheme wal
  103. " }}} vim-plug "
  104. " Mappings {{{ "
  105. " function keys {{{ "
  106. " map <F3> :wa<CR>
  107. map <F4> :wqa<CR>
  108. map <F5> :qa!<CR>
  109. map <F6> :make -C ~/Documents/resume cv<CR>
  110. map <F7> :AutoSaveToggle<CR>
  111. " map <F9> :LLPStartPreview<CR>
  112. map <F9> :VimtexCompile<CR>:VimtexView<CR>
  113. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  114. " }}} function keys "
  115. map <S-Enter> O<ESC>
  116. " splits {{{ "
  117. nnoremap <C-Down> <C-W><C-J>
  118. nnoremap <C-Up> <C-W><C-K>
  119. nnoremap <C-Right> <C-W><C-L>
  120. nnoremap <C-Left> <C-W><C-H>
  121. " Maximize height/width.
  122. nnoremap <C-g> <C-W>_
  123. nnoremap <C-w> <C-W>|
  124. " }}} splits "
  125. " leader mappings {{{ "
  126. let mapleader="\<Space>"
  127. " replace vim-commentary Markdown comments with HTML
  128. nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR>
  129. " delete entire buffer
  130. nnoremap <leader>dg ggdG
  131. " delete line into system clipboard
  132. nnoremap <leader>D "+dd
  133. " delete entire buffer into system clipboard
  134. nnoremap <leader>DA "+ggdG
  135. " reload file
  136. nnoremap <leader>e :e<CR>
  137. " find merge conflicts
  138. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  139. " reload folds
  140. nnoremap <leader>ff :set foldmethod=marker<CR> zM
  141. " toggle search highlighting
  142. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  143. " help
  144. nnoremap <leader>he :help
  145. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  146. nnoremap <leader>vhe :vert help
  147. " move cursor to middle of line
  148. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  149. " don't wrap lines
  150. nnoremap <leader>nw :set nowrap<CR>
  151. " check if in neovim
  152. nnoremap <leader>nv :echo has('nvim')<CR>
  153. " Plug commands
  154. nnoremap <leader>pli :PlugInstall<CR>
  155. nnoremap <leader>plc :PlugClean<CR>
  156. nnoremap <leader>plu :PlugUpdate<CR>
  157. " don't break lines
  158. nnoremap <leader>py :set tw=0<CR>
  159. " replace in next x lines
  160. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  161. " replace in line
  162. nnoremap <leader>rl q:i.s///g<left><left><left>
  163. " reload vim config
  164. nnoremap <leader>rv :source $MYVIMRC<CR>
  165. " replace in entire file
  166. nnoremap <leader>R q:i%s///g<ESC>2F/i
  167. " set syntax to shell (for dotfiles)
  168. nnoremap <leader>s :set syn=sh<CR>
  169. " format current line
  170. nnoremap <leader>w Vgq
  171. " format this and next line
  172. nnoremap <leader>ww Vjgq
  173. " format current 3 lines
  174. nnoremap <leader>www V2jgq
  175. " toggle fold
  176. nnoremap <leader>z za
  177. " copy next thing to system clipboard
  178. nnoremap <leader>y "+
  179. nnoremap <leader>Y "+Y
  180. " yank entire buffer
  181. nnoremap <leader>yg ggyG
  182. " }}} leader mappings "
  183. " }}} Mappings "
  184. " Local Mappings {{{ "
  185. let maplocalleader="-"
  186. autocmd Filetype c inoremap <localleader>s struct pixel
  187. " tex {{{ "
  188. autocmd Filetype tex inoremap <localleader>bt \bowtie
  189. autocmd Filetype tex inoremap <localleader>D \Delta
  190. autocmd Filetype tex inoremap <localleader>e \exists
  191. autocmd Filetype tex inoremap <localleader>ep \epsilon
  192. autocmd Filetype tex inoremap <localleader>fa \forall
  193. autocmd Filetype tex inoremap <localleader>g \geq
  194. autocmd Filetype tex inoremap <localleader>i \in
  195. autocmd Filetype tex inoremap <localleader>l \leq
  196. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  197. autocmd Filetype tex inoremap <localleader>n \neg
  198. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  199. autocmd Filetype tex inoremap <localleader>q \qquad
  200. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  201. autocmd Filetype tex inoremap <localleader>st such that
  202. autocmd Filetype tex inoremap <localleader>t \times
  203. " autocmd Filetype tex inoremap <localleader>T $T$
  204. autocmd Filetype tex inoremap <localleader>T \Theta
  205. " replace bars/underscores in URL
  206. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  207. autocmd Filetype tex inoremap <localleader>v \vee
  208. autocmd Filetype tex inoremap <localleader>w \wedge
  209. autocmd Filetype tex inoremap <localleader>x $x$-axis
  210. autocmd Filetype tex inoremap <localleader>y $y$-axis
  211. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  212. " par3
  213. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  214. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  215. " }}} tex "
  216. autocmd Filetype md inoremap <localleader>x 0f[lRX
  217. " }}} Local Mappings "