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.

294 lines
8.2 KiB

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