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.

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