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.

298 lines
8.3 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
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
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. " apply normal command to selection
  174. vnoremap <leader>n q:anorm
  175. " don't wrap lines
  176. nnoremap <leader>nw :set nowrap<CR>
  177. " check if in neovim
  178. nnoremap <leader>nv :echo has('nvim')<CR>
  179. " Plug commands
  180. nnoremap <leader>pli :PlugInstall<CR>
  181. nnoremap <leader>plc :PlugClean<CR>
  182. nnoremap <leader>plu :PlugUpdate<CR>
  183. " don't break lines
  184. nnoremap <leader>py :set tw=0<CR>
  185. " replace in next x lines
  186. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  187. " replace in line
  188. nnoremap <leader>rl q:i.s///g<left><left><left>
  189. " replace in visual selection
  190. vnoremap <leader>r q:is///g<ESC>3ha
  191. " reload vim config
  192. nnoremap <leader>rv :source $MYVIMRC<CR>
  193. " replace in entire file
  194. nnoremap <leader>R q:i%s///g<ESC>2F/i
  195. " sort lines
  196. nnoremap <leader>so q:i.,.+sort<ESC>Fsi
  197. " set syntax to shell (for dotfiles)
  198. nnoremap <leader>sh :set syn=sh<CR>
  199. " format current line
  200. nnoremap <leader>w Vgq
  201. " format this and next line
  202. nnoremap <leader>ww Vjgq
  203. " format current 3 lines
  204. nnoremap <leader>www V2jgq
  205. " toggle fold
  206. nnoremap <leader>z za
  207. " copy next thing to system clipboard
  208. nnoremap <leader>y "+
  209. nnoremap <leader>Y "+Y
  210. " yank entire buffer
  211. nnoremap <leader>yg ggyG
  212. " }}} leader mappings "
  213. " }}} Mappings "
  214. " Local Mappings {{{ "
  215. let maplocalleader="-"
  216. autocmd Filetype c inoremap <localleader>s struct pixel
  217. " tex {{{ "
  218. autocmd Filetype tex inoremap <localleader>bt \bowtie
  219. autocmd Filetype tex inoremap <localleader>d \delta
  220. autocmd Filetype tex inoremap <localleader>D \Delta
  221. autocmd Filetype tex inoremap <localleader>e \exists
  222. autocmd Filetype tex inoremap <localleader>ep \epsilon
  223. autocmd Filetype tex inoremap <localleader>fa \forall
  224. autocmd Filetype tex inoremap <localleader>g \geq
  225. autocmd Filetype tex inoremap <localleader>i \in
  226. autocmd Filetype tex inoremap <localleader>l \leq
  227. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  228. " autocmd Filetype tex inoremap <localleader>n \neg
  229. autocmd Filetype tex inoremap <localleader>n \neq
  230. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  231. autocmd Filetype tex inoremap <localleader>q \qquad
  232. autocmd Filetype tex inoremap <localleader>r \rightarrow
  233. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  234. autocmd Filetype tex inoremap <localleader>s \subset
  235. autocmd Filetype tex inoremap <localleader>st such that
  236. autocmd Filetype tex inoremap <localleader>S \Sigma
  237. autocmd Filetype tex inoremap <localleader>t \times
  238. " autocmd Filetype tex inoremap <localleader>T $T$
  239. autocmd Filetype tex inoremap <localleader>T \Theta
  240. " replace bars/underscores in URL
  241. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  242. autocmd Filetype tex inoremap <localleader>v \vee
  243. autocmd Filetype tex inoremap <localleader>w \wedge
  244. autocmd Filetype tex inoremap <localleader>x $x$-axis
  245. autocmd Filetype tex inoremap <localleader>y $y$-axis
  246. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  247. " par3
  248. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  249. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  250. " }}} tex "
  251. autocmd Filetype md inoremap <localleader>x 0f[lRX
  252. " }}} Local Mappings "