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.

424 lines
12 KiB

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