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.

275 lines
7.7 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
  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. " }}} 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. Plug 'PotatoesMaster/i3-vim-syntax'
  108. call plug#end()
  109. " colorscheme gotham256
  110. colorscheme wal
  111. " }}} vim-plug "
  112. " Mappings {{{ "
  113. " function keys {{{ "
  114. " map <F3> :wa<CR>
  115. map <F4> :wqa<CR>
  116. map <F5> :qa!<CR>
  117. map <F6> :make -C ~/Documents/resume cv<CR>
  118. map <F7> :AutoSaveToggle<CR>
  119. " map <F9> :LLPStartPreview<CR>
  120. map <F9> :VimtexCompile<CR>:VimtexView<CR>
  121. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  122. " }}} function keys "
  123. map <S-Enter> O<ESC>
  124. vnoremap <C-X> <Esc>`.``gvP``P
  125. " splits {{{ "
  126. nnoremap <C-Down> <C-W><C-J>
  127. nnoremap <C-Up> <C-W><C-K>
  128. nnoremap <C-Right> <C-W><C-L>
  129. nnoremap <C-Left> <C-W><C-H>
  130. " Maximize height/width.
  131. nnoremap <C-g> <C-W>_
  132. nnoremap <C-w> <C-W>|
  133. " }}} splits "
  134. " leader mappings {{{ "
  135. let mapleader="\<Space>"
  136. " replace vim-commentary Markdown comments with HTML
  137. nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR>
  138. " delete entire buffer
  139. nnoremap <leader>dg ggdG
  140. " delete line into system clipboard
  141. nnoremap <leader>D "+dd
  142. " delete entire buffer into system clipboard
  143. nnoremap <leader>DA "+ggdG
  144. " reload file
  145. nnoremap <leader>e :e<CR>
  146. " find merge conflicts
  147. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  148. " reload folds
  149. nnoremap <leader>ff :set foldmethod=marker<CR> zM
  150. " toggle search highlighting
  151. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  152. " help
  153. nnoremap <leader>he :help
  154. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  155. nnoremap <leader>vhe :vert help
  156. " move cursor to middle of line
  157. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  158. " don't wrap lines
  159. nnoremap <leader>nw :set nowrap<CR>
  160. " check if in neovim
  161. nnoremap <leader>nv :echo has('nvim')<CR>
  162. " Plug commands
  163. nnoremap <leader>pli :PlugInstall<CR>
  164. nnoremap <leader>plc :PlugClean<CR>
  165. nnoremap <leader>plu :PlugUpdate<CR>
  166. " don't break lines
  167. nnoremap <leader>py :set tw=0<CR>
  168. " replace in next x lines
  169. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  170. " replace in line
  171. nnoremap <leader>rl q:i.s///g<left><left><left>
  172. " reload vim config
  173. nnoremap <leader>rv :source $MYVIMRC<CR>
  174. " replace in entire file
  175. nnoremap <leader>R q:i%s///g<ESC>2F/i
  176. " sort lines
  177. nnoremap <leader>s q:i.,.+sort<ESC>Fsi
  178. " set syntax to shell (for dotfiles)
  179. nnoremap <leader>sh :set syn=sh<CR>
  180. " format current line
  181. nnoremap <leader>w Vgq
  182. " format this and next line
  183. nnoremap <leader>ww Vjgq
  184. " format current 3 lines
  185. nnoremap <leader>www V2jgq
  186. " toggle fold
  187. nnoremap <leader>z za
  188. " copy next thing to system clipboard
  189. nnoremap <leader>y "+
  190. nnoremap <leader>Y "+Y
  191. " yank entire buffer
  192. nnoremap <leader>yg ggyG
  193. " }}} leader mappings "
  194. " }}} Mappings "
  195. " Local Mappings {{{ "
  196. let maplocalleader="-"
  197. autocmd Filetype c inoremap <localleader>s struct pixel
  198. " tex {{{ "
  199. autocmd Filetype tex inoremap <localleader>bt \bowtie
  200. autocmd Filetype tex inoremap <localleader>d \delta
  201. autocmd Filetype tex inoremap <localleader>D \Delta
  202. autocmd Filetype tex inoremap <localleader>e \exists
  203. autocmd Filetype tex inoremap <localleader>ep \epsilon
  204. autocmd Filetype tex inoremap <localleader>fa \forall
  205. autocmd Filetype tex inoremap <localleader>g \geq
  206. autocmd Filetype tex inoremap <localleader>i \in
  207. autocmd Filetype tex inoremap <localleader>l \leq
  208. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  209. " autocmd Filetype tex inoremap <localleader>n \neg
  210. autocmd Filetype tex inoremap <localleader>n \neq
  211. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  212. autocmd Filetype tex inoremap <localleader>q \qquad
  213. autocmd Filetype tex inoremap <localleader>r \Rightarrow
  214. autocmd Filetype tex inoremap <localleader>st such that
  215. autocmd Filetype tex inoremap <localleader>S \Sigma
  216. autocmd Filetype tex inoremap <localleader>t \times
  217. " autocmd Filetype tex inoremap <localleader>T $T$
  218. autocmd Filetype tex inoremap <localleader>T \Theta
  219. " replace bars/underscores in URL
  220. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  221. autocmd Filetype tex inoremap <localleader>v \vee
  222. autocmd Filetype tex inoremap <localleader>w \wedge
  223. autocmd Filetype tex inoremap <localleader>x $x$-axis
  224. autocmd Filetype tex inoremap <localleader>y $y$-axis
  225. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  226. " par3
  227. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  228. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  229. " }}} tex "
  230. autocmd Filetype md inoremap <localleader>x 0f[lRX
  231. " }}} Local Mappings "