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.

263 lines
7.4 KiB

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