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.

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