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.

349 lines
10 KiB

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
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
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
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 mouse=a
  17. set clipboard+=unnamedplus
  18. set foldmethod=marker
  19. set linespace=5
  20. " cursor indicator {{{ "
  21. " set listchars=tab:\|\
  22. " set list
  23. " set cursorcolumn
  24. " set cursorline
  25. " }}} cursor indicator "
  26. " set timeoutlen=500
  27. set timeoutlen=350
  28. set hlsearch
  29. set noswapfile
  30. " let maplocalleader="-"
  31. let maplocalleader="\\"
  32. " }}} set x=y "
  33. " commands for file types {{{ "
  34. autocmd VimResized * wincmd =
  35. autocmd BufNewFile,BufRead .* set syntax=sh
  36. filetype plugin on
  37. filetype indent on
  38. autocmd FileType *css,htmldjango,html,tex,markdown,yaml set tabstop=2 shiftwidth=2 expandtab
  39. autocmd BufNewFile,BufRead *.txt set tabstop=2 shiftwidth=2 expandtab
  40. autocmd BufNewFile,BufRead watson*.fish set tabstop=2 shiftwidth=2 expandtab
  41. autocmd BufRead commit-msg.txt set filetype=gitcommit tw=72
  42. autocmd BufNewFile,BufRead *.md set filetype=markdown
  43. autocmd Filetype markdown set textwidth=0
  44. " autocmd Filetype html set foldmarker=0
  45. autocmd BufWritePost key_* !sync-shortcuts
  46. autocmd VimLeave *.tex !tex-clean %
  47. " " auto-reload vimrc {{{ "
  48. " augroup myvimrc
  49. " au!
  50. " au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
  51. " augroup END
  52. " " }}} auto-reload vimrc "
  53. " }}} commands for file types "
  54. " vim-plug {{{ "
  55. " plug auto-install
  56. if empty(glob('~/.vim/autoload/plug.vim'))
  57. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  58. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  59. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  60. endif
  61. call plug#begin('~/.vim/plugged')
  62. " prequisite for other plugins
  63. Plug 'vim-scripts/L9'
  64. " find files from within Vim
  65. " Plug 'vim-scripts/FuzzyFinder'
  66. " Gotham color scheme
  67. " Plug 'whatyouhide/vim-gotham'
  68. " " collection of Vim color schemes
  69. " Plug 'flazz/vim-colorschemes'
  70. " " preview Vim color scheme easily within Vim
  71. " Plug 'xolox/vim-colorscheme-switcher'
  72. " " prerequisite for above plugin
  73. " Plug 'xolox/vim-misc'
  74. " automatically save buffers upon returning to normal mode
  75. Plug '907th/vim-auto-save'
  76. let g:auto_save = 1
  77. " provides various functionality for writing LaTeX in Vim
  78. Plug 'lervag/vimtex'
  79. au BufWritePost *.tex silent call Tex_RunLaTeX()
  80. au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
  81. let g:vimtex_view_general_viewer = 'zathura'
  82. let g:vimtex_quickfix_latexlog = {
  83. \ 'overfull' : 0,
  84. \ 'underfull' : 0,
  85. \ 'global' : 0,
  86. \ 'unused' : 0,
  87. \}
  88. " auto-completion for various languages
  89. Plug 'Valloric/YouCompleteMe'
  90. let g:ycm_filetype_blacklist = {
  91. \ 'tagbar': 1,
  92. \ 'qf': 1,
  93. \ 'notes': 1,
  94. \ 'unite': 1,
  95. \ 'vimwiki': 1,
  96. \ 'pandoc': 1,
  97. \ 'infolog': 1,
  98. \ 'mail': 1
  99. \}
  100. " wrote short bits of text that expand into whatever you want
  101. " demo: https://www.youtube.com/watch?v=Zik6u0klD40
  102. Plug 'SirVer/ultisnips'
  103. " better key bindings for UltiSnipsExpandTrigger
  104. let g:UltiSnipsExpandTrigger = "<tab>"
  105. let g:UltiSnipsJumpForwardTrigger = "<tab>"
  106. let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
  107. " custom snippets
  108. Plug 'Kevin-Mok/vim-snippets'
  109. " to make YouCompleteMe work with UltiSnips (both use Tab)
  110. Plug 'ervandew/supertab'
  111. " make YCM compatible with UltiSnips (using supertab)
  112. let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
  113. let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
  114. let g:SuperTabDefaultCompletionType = '<C-n>'
  115. " easily comment/uncomment lines
  116. Plug 'scrooloose/nerdcommenter'
  117. let g:NERDTrimTrailingWhitespace = 1
  118. let g:NERDSpaceDelims = 1
  119. " add quotes/brackets around chunks of text easily
  120. Plug 'tpope/vim-surround'
  121. " navigate around file easily and precisely
  122. Plug 'easymotion/vim-easymotion'
  123. map <Space> <Plug>(easymotion-prefix)
  124. " status bar displaying various info about the current buffer
  125. Plug 'vim-airline/vim-airline'
  126. let g:airline_section_c = '%F'
  127. Plug 'vim-airline/vim-airline-themes'
  128. let g:airline_powerline_fonts = 1
  129. " continue Markdown lists when started
  130. Plug 'dkarter/bullets.vim'
  131. " coordinate Vim color scheme with terminal color scheme
  132. Plug 'dylanaraps/wal.vim'
  133. " repeat plugin commands
  134. Plug 'tpope/vim-repeat'
  135. " better Django support
  136. Plug 'tweekmonster/django-plus.vim'
  137. " auto-close brackets
  138. Plug 'jiangmiao/auto-pairs'
  139. let g:AutoPairsMapSpace = 0
  140. Plug 'henrik/vim-indexed-search'
  141. Plug 'PotatoesMaster/i3-vim-syntax'
  142. " vim file explorer
  143. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  144. Plug 'terryma/vim-multiple-cursors'
  145. " let g:multi_cursor_select_all_word_key='<C-a>'
  146. Plug 'dag/vim-fish'
  147. call plug#end()
  148. " }}} vim-plug "
  149. " colorscheme gotham256
  150. colorscheme wal
  151. " Mappings {{{ "
  152. " function keys {{{ "
  153. " map <F1> :silent !scp %:p k@192.168.0.17:/home/k/a1<CR>
  154. " map <F2> :silent !gcc -m32 -o test_full test_full.c && scp test_full k@192.168.0.17:/home/k/a1<CR>
  155. " map <F2> :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1<CR>
  156. " map <F3> :silent !gcc -m32 -o test_intercept test_intercept.c && scp test_intercept k@192.168.0.17:/home/k/a1<CR>
  157. map <F4> :xa<CR>
  158. map <F5> :q!<CR>
  159. " map <F6> :make -C ~/Documents/resume cv<CR>
  160. " map <F7> :AutoSaveToggle<CR>
  161. map <F8> :!clear && shellcheck %<CR>
  162. map <F9> :VimtexCompile<CR>:VimtexView<CR>
  163. " map <F9> :VimtexCompile<CR>
  164. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  165. " }}} function keys "
  166. map <S-Enter> O<ESC>
  167. " swap text visually
  168. vnoremap <C-P> <Esc>`.``gvP``P
  169. " splits {{{ "
  170. nnoremap <C-Down> <C-W><C-J>
  171. nnoremap <C-Up> <C-W><C-K>
  172. nnoremap <C-Right> <C-W><C-L>
  173. nnoremap <C-Left> <C-W><C-H>
  174. " Maximize height/width.
  175. nnoremap <C-g> <C-W>_
  176. nnoremap <C-w> <C-W>|
  177. " }}} splits "
  178. " leader mappings {{{ "
  179. let mapleader="\<Space>"
  180. " replace until end of line
  181. nnoremap <leader>c c$
  182. " delete entire buffer
  183. nnoremap <leader>d d$
  184. " delete entire buffer
  185. nnoremap <leader>dg ggdG
  186. " delete line into system clipboard
  187. nnoremap <leader>D "+dd
  188. " delete entire buffer into system clipboard
  189. nnoremap <leader>DA "+ggdG
  190. " find copied text
  191. nnoremap <leader>f q/p<CR>
  192. " find alias
  193. nnoremap <leader>fa /^ <Left>
  194. " find merge conflicts
  195. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  196. " reload folds
  197. nnoremap <leader>ff :set foldmethod=marker<CR> zM
  198. " find copied text
  199. nnoremap <leader>ft /TODO<CR>
  200. nnoremap <leader>g :YcmCompleter GoTo<CR>
  201. " toggle search highlighting
  202. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  203. " help
  204. nnoremap <leader>he :help
  205. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  206. nnoremap <leader>vhe :vert help
  207. " move cursor to middle of line
  208. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  209. " apply normal command to selection
  210. vnoremap <leader>n q:anorm
  211. " don't wrap lines
  212. nnoremap <leader>nw :set nowrap<CR>
  213. " check if in neovim
  214. nnoremap <leader>nv :echo has('nvim')<CR>
  215. " Plug commands
  216. nnoremap <leader>p "*p
  217. nnoremap <leader>pli :PlugInstall<CR>
  218. nnoremap <leader>plc :PlugClean<CR>
  219. nnoremap <leader>plu :PlugUpdate<CR>
  220. " don't break lines
  221. nnoremap <leader>py :set tw=0<CR>
  222. " reload file
  223. nnoremap <leader>r :e<CR>
  224. " replace in next x lines
  225. nnoremap <leader>re q:i.,.+s///g<ESC>Fsi
  226. " replace in line
  227. nnoremap <leader>rl q:i.s///g<left><left><left>
  228. " replace in visual selection
  229. vnoremap <leader>r q:is///g<ESC>3ha
  230. " reload vim config
  231. nnoremap <leader>rv :source $MYVIMRC<CR>
  232. " replace in entire file
  233. nnoremap <leader>R q:i%s///g<ESC>2F/i
  234. " sort lines until end of file
  235. vnoremap <leader>s :sort<CR>
  236. " run current file in shell
  237. nnoremap <leader>sh :!%:p<CR>
  238. " sort lines until end of file
  239. nnoremap <leader>so q:i.,$sort<CR>
  240. " sort lines
  241. nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
  242. " set syntax to shell (for dotfiles)
  243. nnoremap <leader>sys :set syn=sh<CR>
  244. " open vimrc in vertical split
  245. nnoremap <leader>vv :vsp ~/.vimrc<CR>
  246. " format current line
  247. nnoremap <leader>ww Vgq
  248. " format this and next line
  249. nnoremap <leader>www Vjgq
  250. " copy next thing to system clipboard
  251. " nnoremap <leader>y "+
  252. " nnoremap <leader>Y "+Y
  253. nnoremap <leader>y y$
  254. " yank entire buffer
  255. nnoremap <leader>yg ggyG
  256. " toggle fold
  257. nnoremap <leader>z za
  258. " }}} leader mappings "
  259. " }}} Mappings "
  260. " Local Mappings {{{ "
  261. autocmd Filetype fish inoremap <localleader>1 $argv[1]
  262. autocmd Filetype fish inoremap <localleader>2 $argv[2]
  263. autocmd Filetype markdown nnoremap <localleader>x 0f[lrx
  264. " nnoremap <localleader>x 0f[lrx
  265. " tex {{{ "
  266. autocmd Filetype tex inoremap <localleader>bt \bowtie
  267. autocmd Filetype tex inoremap <localleader>c \checkmark
  268. autocmd Filetype tex inoremap <localleader>d \delta
  269. autocmd Filetype tex inoremap <localleader>D \Delta
  270. autocmd Filetype tex inoremap <localleader>e \exists
  271. autocmd Filetype tex inoremap <localleader>ep \epsilon
  272. autocmd Filetype tex inoremap <localleader>fa \forall
  273. autocmd Filetype tex inoremap <localleader>g \geq
  274. autocmd Filetype tex inoremap <localleader>i \in
  275. autocmd Filetype tex inoremap <localleader>l \leq
  276. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  277. " autocmd Filetype tex inoremap <localleader>n \neg
  278. autocmd Filetype tex inoremap <localleader>n \neq
  279. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  280. autocmd Filetype tex inoremap <localleader>q \qquad
  281. autocmd Filetype tex inoremap <localleader>r \rightarrow
  282. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  283. autocmd Filetype tex inoremap <localleader>s \subset
  284. autocmd Filetype tex inoremap <localleader>st such that
  285. autocmd Filetype tex inoremap <localleader>S \Sigma
  286. autocmd Filetype tex inoremap <localleader>t \times
  287. " autocmd Filetype tex inoremap <localleader>T $T$
  288. autocmd Filetype tex inoremap <localleader>T \Theta
  289. " replace bars/underscores in URL
  290. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  291. autocmd Filetype tex inoremap <localleader>v \vee
  292. autocmd Filetype tex inoremap <localleader>w \wedge
  293. autocmd Filetype tex inoremap <localleader>x $x$-axis
  294. autocmd Filetype tex inoremap <localleader>y $y$-axis
  295. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  296. " par3
  297. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  298. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  299. " }}} tex "
  300. " }}} Local Mappings "