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.

422 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. " ]]] vim-plug "
  195. " Mappings [[[ "
  196. call plug#end()
  197. " colorscheme gotham256
  198. colorscheme wal
  199. nnoremap > >>
  200. nnoremap < <<
  201. inoremap << <Esc><<A
  202. " function keys [[[ "
  203. map <F3> :wa<CR>
  204. map <F4> :xa<CR>
  205. map <F5> :q!<CR>
  206. map <F6> :qa!<CR>
  207. map <F7> :AutoSaveToggle<CR>
  208. " reload file
  209. nnoremap <F9> :e<CR>
  210. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  211. nnoremap <F11> :set paste<CR>"*p:set nopaste<CR>
  212. " ]]] function keys "
  213. map <S-Enter> O<ESC>
  214. " swap text visually
  215. vnoremap <C-P> <Esc>`.``gvP``P
  216. ino <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
  217. " splits [[[ "
  218. nnoremap <C-Down> <C-W><C-J>
  219. nnoremap <C-Up> <C-W><C-K>
  220. nnoremap <C-Right> <C-W><C-L>
  221. nnoremap <C-Left> <C-W><C-H>
  222. " Maximize height/width.
  223. nnoremap <C-g> <C-W>_
  224. nnoremap <C-w> <C-W>|
  225. " ]]] splits "
  226. " leader mappings [[[ "
  227. let mapleader="\<Space>"
  228. " find alias
  229. nnoremap <leader>a /^ <Left>
  230. " replace until end of line
  231. nnoremap <leader>c c$
  232. " delete entire buffer
  233. nnoremap <leader>d d$
  234. " delete entire buffer
  235. nnoremap <leader>dg ggdG
  236. " delete line into system clipboard
  237. nnoremap <leader>D "+dd
  238. " delete entire buffer into system clipboard
  239. nnoremap <leader>DA "+ggdG
  240. " find copied text
  241. nnoremap <leader>f q/p<CR>
  242. " find merge conflicts
  243. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  244. " reload folds
  245. nnoremap <leader>fmi :set foldmethod=indent<CR> zM
  246. nnoremap <leader>fmm :set foldmethod=marker<CR> zM
  247. " add marker foldmethod modeline
  248. nnoremap <leader>fi :YcmCompleter FixIt<CR>
  249. " find copied text
  250. nnoremap <leader>ft /TODO<CR>
  251. nnoremap <leader>g :YcmCompleter GoTo<CR>
  252. " vimdiff split
  253. nnoremap <leader>gd :Gvdiff
  254. nnoremap <leader>gdh :Gvdiff HEAD~
  255. nnoremap <leader>gdm :Gvdiff master<CR>
  256. " toggle search highlighting
  257. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  258. " help
  259. nnoremap <leader>he :help
  260. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  261. nnoremap <leader>vhe :vert help
  262. " format current line
  263. nnoremap <leader>l Vgq
  264. " format this and next line
  265. nnoremap <leader>ll Vjgq
  266. " move cursor to middle of line
  267. nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  268. " apply normal command to selection
  269. vnoremap <leader>n q:anorm
  270. " don't wrap lines
  271. nnoremap <leader>nw :set nowrap<CR>
  272. " check if in neovim
  273. nnoremap <leader>nv :echo has('nvim')<CR>
  274. " Plug commands
  275. nnoremap <leader>p "*p
  276. nnoremap <leader>pli :PlugInstall<CR>
  277. nnoremap <leader>plc :PlugClean<CR>
  278. nnoremap <leader>plu :PlugUpdate<CR>
  279. " don't break lines
  280. nnoremap <leader>py :set tw=0<CR>
  281. " replace in next x lines
  282. nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  283. " replace in line
  284. nnoremap <leader>rl q:i.s///g<left><left><left>
  285. " replace in visual selection
  286. vnoremap <leader>r q:is///g<ESC>3ha
  287. " reload vim config
  288. nnoremap <leader>rv :source $MYVIMRC<CR>
  289. " replace in entire file
  290. nnoremap <leader>R q:i%s///g<ESC>2F/i
  291. vnoremap <leader>s :sort<CR>
  292. nnoremap <leader>sc :set spell spelllang=en_us<CR>
  293. " run current file in shell
  294. nnoremap <leader>sh :!%:p
  295. " sort lines until end of file
  296. nnoremap <leader>so q:i.,$sort<CR>
  297. " sort lines
  298. nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
  299. " set syntax to shell (for dotfiles)
  300. nnoremap <leader>sys :set syn=sh<CR>
  301. vnoremap <leader>t :!tac<CR>
  302. " capitalize letter
  303. nnoremap <leader>u vU
  304. " open vimrc in vertical split
  305. nnoremap <leader>vv :vsp ~/.vimrc<CR>
  306. " copy next thing to system clipboard
  307. " nnoremap <leader>y "+
  308. " nnoremap <leader>Y "+Y
  309. nnoremap <leader>y y$
  310. " yank entire buffer
  311. nnoremap <leader>yg ggyG
  312. " toggle fold
  313. nnoremap <leader>z za
  314. " ]]] leader mappings "
  315. " ]]] Mappings "
  316. " Local Mappings [[[ "
  317. let maplocalleader="\\"
  318. " tex [[[ "
  319. autocmd Filetype tex inoremap <localleader>bt \bowtie
  320. autocmd Filetype tex inoremap <localleader>c \checkmark
  321. autocmd Filetype tex inoremap <localleader>d \delta
  322. autocmd Filetype tex inoremap <localleader>D \Delta
  323. autocmd Filetype tex inoremap <localleader>e \exists
  324. autocmd Filetype tex inoremap <localleader>ep \epsilon
  325. autocmd Filetype tex inoremap <localleader>fa \forall
  326. autocmd Filetype tex inoremap <localleader>g \geq
  327. autocmd Filetype tex inoremap <localleader>i \in
  328. autocmd Filetype tex inoremap <localleader>l \leq
  329. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  330. " autocmd Filetype tex inoremap <localleader>n \neg
  331. autocmd Filetype tex inoremap <localleader>n \neq
  332. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  333. autocmd Filetype tex inoremap <localleader>q \qquad
  334. autocmd Filetype tex inoremap <localleader>r \rightarrow
  335. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  336. autocmd Filetype tex inoremap <localleader>s \subset
  337. autocmd Filetype tex inoremap <localleader>st such that
  338. autocmd Filetype tex inoremap <localleader>S \Sigma
  339. autocmd Filetype tex inoremap <localleader>t \times
  340. " autocmd Filetype tex inoremap <localleader>T $T$
  341. autocmd Filetype tex inoremap <localleader>T \Theta
  342. " replace bars/underscores in URL
  343. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  344. autocmd Filetype tex inoremap <localleader>v \vee
  345. autocmd Filetype tex inoremap <localleader>w \wedge
  346. autocmd Filetype tex inoremap <localleader>x $x$-axis
  347. autocmd Filetype tex inoremap <localleader>y $y$-axis
  348. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  349. " par3
  350. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  351. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  352. " ]]] tex "
  353. autocmd Filetype c inoremap <localleader>uc unsigned char
  354. autocmd BufNewFile,BufRead *.h nnoremap <localleader>x 0iextern <Esc>f{hc$;<Esc>
  355. autocmd Filetype fish inoremap <localleader>1 $argv[1]
  356. autocmd Filetype fish inoremap <localleader>2 $argv[2]
  357. autocmd Filetype javascript inoremap <localleader>x process.exit()
  358. autocmd Filetype markdown nnoremap <localleader>x 0f[lrx
  359. " nnoremap <localleader>x 0f[lrx
  360. autocmd Filetype go-template inoremap <localleader>e {{"{{ else }}"}}
  361. " ]]] Local Mappings "