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.

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