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.

657 lines
21 KiB

5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
4 years ago
5 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
5 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
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
5 years ago
6 years ago
5 years ago
5 years ago
5 years ago
2 years ago
5 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
6 years ago
2 years ago
6 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
5 years ago
5 years ago
5 years ago
3 years ago
4 years ago
3 years ago
4 years ago
6 years ago
6 years ago
  1. " set x=y [[[ "
  2. set autoindent
  3. set autoread
  4. set background=dark
  5. " set colorcolumn=80
  6. set clipboard+=unnamedplus
  7. set diffopt=filler,context:3
  8. if has('nvim-0.3.2') || has("patch-8.1.0360")
  9. set diffopt=filler,internal,algorithm:histogram,indent-heuristic
  10. endif
  11. set encoding=utf-8
  12. set expandtab
  13. " set foldmethod=indent
  14. set foldmethod=marker
  15. set hlsearch
  16. " set ignorecase
  17. set linebreak
  18. set linespace=5
  19. set mouse=a
  20. " set mouse=c
  21. set nofixendofline
  22. " set noswapfile
  23. set relativenumber
  24. set shiftwidth=4
  25. set smartcase
  26. set tabstop=4
  27. " set t_Co=256
  28. " set termguicolors
  29. set timeoutlen=350
  30. " set timeoutlen=200
  31. " set tw=75
  32. " set tw=70
  33. set tw=60
  34. set undodir=~/.vim/undo
  35. set undofile
  36. " set updatetime=1000
  37. " set updatetime=500
  38. set updatetime=0
  39. autocmd VimResized * wincmd =
  40. filetype plugin on
  41. filetype indent on
  42. syntax on
  43. autocmd CursorHold * if !bufexists("[Command Line]") | checktime | endif
  44. " cursor indicator [[[ "
  45. " set listchars=tab:\|\
  46. " set list
  47. " set cursorcolumn
  48. " set cursorline
  49. " ]]] cursor indicator "
  50. " ]]] set x=y "
  51. " commands for file types [[[ "
  52. autocmd BufNewFile,BufRead .* set syntax=sh
  53. autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
  54. autocmd FileType *css,gitcommit,haskell,htmldjango,html,graphql,javascript,javascriptreact,json,lisp,markdown,
  55. \racket,tex,text,yaml set tabstop=2 shiftwidth=2
  56. " autocmd BufNewFile,BufRead *.md set filetype=markdown
  57. " autocmd Filetype markdown set textwidth=0
  58. " autocmd Filetype html set foldmarker=0
  59. autocmd BufNewFile,BufRead *.gd set expandtab!
  60. autocmd Filetype go set noexpandtab sw=4
  61. " autocmd FileType go,html,java,javascript,python,lua set fdm=indent
  62. " autocmd FileType go,html,java,javascript,javascriptreact,Jenkinsfile,python,lua set fdm=indent
  63. autocmd FileType go,html,java,Jenkinsfile,python,lua set fdm=indent
  64. " autocmd FileType html,javascript,Jenkinsfile,python,lua set fdm=indent
  65. autocmd BufNewFile,BufRead *.gql setfiletype graphql
  66. autocmd Filetype markdown let g:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''", "*":"*"}
  67. " autocmd Filetype markdown map <F8> :LivedownToggle<CR>
  68. autocmd Filetype markdown let g:AutoPairs={'(':')', '[':']', '{':'}','"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''","*":"*"}
  69. autocmd Filetype markdown map <F8> :InstantMarkdownPreview<CR>
  70. autocmd Filetype markdown map <F9> :InstantMarkdownStop<CR>:InstantMarkdownPreview<CR>
  71. autocmd Filetype markdown inoremap <Tab> <Esc>>>A
  72. autocmd Filetype markdown inoremap <S-Tab> <Esc><<A
  73. autocmd Filetype markdown inoremap < <Esc><<A
  74. autocmd Filetype markdown inoremap << <
  75. autocmd Filetype markdown inoremap > <Esc>>>A
  76. autocmd Filetype markdown inoremap >> >
  77. " autocmd Filetype markdown set commentstring=<!---\ %s\ -->
  78. " format options [[[ "
  79. " a = auto-format paragraphs
  80. " c = wrap comments
  81. " j = remove comment header when joining lines
  82. " M = don't add space when joining lines
  83. " q = format comments with gq
  84. " t = wrap lines
  85. " v = break lines in insert
  86. " w = whitespace continues paragraph
  87. " ]]] format options "
  88. " autocmd FileType markdown,tex,text set spell spelllang=en_us formatoptions=acjMqtvw
  89. autocmd FileType markdown,tex,text set spell spelllang=en_us formatoptions=cjMqtvw
  90. autocmd Filetype groovy,Jenkinsfile,taskdata set tw=0
  91. autocmd Filetype json nnoremap <leader>j :%!python -m json.tool<CR>
  92. autocmd Filetype json set foldmethod=marker
  93. autocmd Filetype racket set commentstring=;%s;
  94. autocmd Filetype racket let g:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"}
  95. autocmd FileType sh map <F8> :!clear && shellcheck %<CR>
  96. autocmd FileType tex set updatetime=1000 timeoutlen=300
  97. autocmd FileType tex map <F8> :VimtexCompile<CR>
  98. autocmd VimEnter *.tex VimtexCompile
  99. autocmd VimLeave *.tex !tex-clean %:p
  100. autocmd BufNewFile,BufRead *.tmpl set tw=0 sw=2 ft=go-template fmr=[[[,]]]
  101. " " auto-reload vimrc [[[ "
  102. " augroup myvimrc
  103. " au!
  104. " au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
  105. " augroup END
  106. " " ]]] auto-reload vimrc "
  107. " ]]] commands for file types "
  108. " commands for specific files [[[ "
  109. autocmd BufNewFile,BufRead watson*.fish set tabstop=2 shiftwidth=2 expandtab
  110. autocmd BufWritePost config.def.h silent !cd %:p:h; sudo rm config.h; sudo bear make install
  111. " autocmd BufRead config.def.h map <F8> :silent !cd %:p:h; sudo rm config.h; sudo bear make install<CR>
  112. autocmd BufRead config.def.h map <F10> :silent !cd %:p:h<CR>:!sudo rm config.h; sudo bear make install<CR>
  113. autocmd BufRead config.def.h set updatetime=3000
  114. autocmd BufRead commit-msg.txt set filetype=gitcommit tw=72
  115. autocmd VimLeave /etc/default/grub !sudo grub-mkconfig -o /boot/grub/grub.cfg
  116. " autocmd BufWritePost key_* !sync-shortcuts
  117. autocmd BufNewFile,BufRead key_* map <F1> :w<CR>:silent !sync-shortcuts<CR>
  118. " map <F1> :silent !scp %:p k@192.168.0.17:/home/k/a1<CR>
  119. " map <F2> :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1<CR>
  120. " map <F6> :make -C ~/Documents/resume cv<CR>
  121. " ]]] commands for specific files "
  122. " vim-plug [[[
  123. " plug auto-install
  124. if empty(glob('~/.vim/autoload/plug.vim'))
  125. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  126. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  127. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  128. endif
  129. call plug#begin('~/.vim/plugged')
  130. " prequisite for other plugins
  131. Plug 'vim-scripts/L9'
  132. " find files from within Vim
  133. " Plug 'vim-scripts/FuzzyFinder'
  134. {{ if not .gui }}
  135. " Gotham color scheme
  136. Plug 'whatyouhide/vim-gotham'
  137. {{ end }}
  138. " " collection of Vim color schemes
  139. " Plug 'flazz/vim-colorschemes'
  140. " " preview Vim color scheme easily within Vim
  141. " Plug 'xolox/vim-colorscheme-switcher'
  142. " " prerequisite for above plugin
  143. " Plug 'xolox/vim-misc'
  144. " automatically save buffers upon returning to normal mode
  145. Plug '907th/vim-auto-save'
  146. let g:auto_save = 1
  147. " let g:auto_save_events = ["CursorHold", "CursorHoldI"]
  148. let g:auto_save_events = ["CursorHold"]
  149. " autocmd VimEnter *.tex let g:auto_save = 0
  150. " provides various functionality for writing LaTeX in Vim
  151. Plug 'lervag/vimtex'
  152. " au BufWritePost *.tex silent call Tex_RunLaTeX()
  153. au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
  154. let g:Tex_MultipleCompileFormats = 'dvi,pdf'
  155. " let g:vimtex_view_general_viewer = 'evince'
  156. let g:vimtex_view_general_viewer = 'zathura'
  157. " let g:vimtex_quickfix_latexlog = {
  158. " \ 'overfull' : 0,
  159. " \ 'underfull' : 0,
  160. " \ 'global' : 0,
  161. " \ 'packages' : {
  162. " \ 'biblatex' : 0,
  163. " \ 'gensymb' : 0,
  164. " \ },
  165. " \ 'references' : 0,
  166. " \ 'unused' : 0,
  167. " \}
  168. let g:vimtex_quickfix_ignore_filters = [
  169. \'Overfull',
  170. \]
  171. let g:vimtex_quickfix_autoclose_after_keystrokes = 5
  172. let g:vimtex_compiler_latexmk = {
  173. \ 'continuous' : 1,
  174. \}
  175. " \ 'continuous' : 0,
  176. {{ if not (eq .chezmoi.username "root") }}
  177. " auto-completion for various languages
  178. Plug 'Valloric/YouCompleteMe'
  179. let g:ycm_filetype_blacklist = {
  180. \ 'tagbar': 1,
  181. \ 'qf': 1,
  182. \ 'notes': 1,
  183. \ 'unite': 1,
  184. \ 'vimwiki': 1,
  185. \ 'pandoc': 1,
  186. \ 'infolog': 1,
  187. \ 'mail': 1
  188. \}
  189. {{ end }}
  190. " wrote short bits of text that expand into whatever you want
  191. " demo: https://www.youtube.com/watch?v=Zik6u0klD40
  192. Plug 'SirVer/ultisnips'
  193. " better key bindings for UltiSnipsExpandTrigger
  194. let g:UltiSnipsExpandTrigger = "<tab>"
  195. let g:UltiSnipsJumpForwardTrigger = "<tab>"
  196. let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
  197. let g:ultisnips_javascript = {
  198. \ 'keyword-spacing': 'always',
  199. \ 'semi': 'never',
  200. \ 'space-before-function-paren': 'never',
  201. \ }
  202. " custom snippets
  203. Plug 'Kevin-Mok/vim-snippets'
  204. " to make YouCompleteMe work with UltiSnips (both use Tab)
  205. Plug 'ervandew/supertab'
  206. " make YCM compatible with UltiSnips (using supertab)
  207. let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
  208. let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
  209. let g:SuperTabDefaultCompletionType = '<C-n>'
  210. " easily comment/uncomment lines
  211. Plug 'scrooloose/nerdcommenter'
  212. let g:NERDTrimTrailingWhitespace = 1
  213. let g:NERDSpaceDelims = 1
  214. " add quotes/brackets around chunks of text easily
  215. Plug 'tpope/vim-surround'
  216. nmap S ys
  217. " navigate around file easily and precisely
  218. Plug 'easymotion/vim-easymotion'
  219. map <Space> <Plug>(easymotion-prefix)
  220. " status bar displaying various info about the current buffer
  221. Plug 'vim-airline/vim-airline'
  222. let g:airline_section_c = '%F'
  223. Plug 'vim-airline/vim-airline-themes'
  224. let g:airline_powerline_fonts = 1
  225. " continue Markdown lists when started
  226. Plug 'dkarter/bullets.vim'
  227. " coordinate Vim color scheme with terminal color scheme
  228. Plug 'dylanaraps/wal.vim'
  229. " repeat plugin commands
  230. Plug 'tpope/vim-repeat'
  231. " better Django support
  232. Plug 'tweekmonster/django-plus.vim'
  233. " auto-close brackets
  234. Plug 'jiangmiao/auto-pairs'
  235. let g:AutoPairsMapSpace = 0
  236. Plug 'henrik/vim-indexed-search'
  237. Plug 'PotatoesMaster/i3-vim-syntax'
  238. " vim file explorer
  239. Plug 'terryma/vim-multiple-cursors'
  240. " let g:multi_cursor_select_all_word_key='<C-a>'
  241. let g:multi_cursor_exit_from_visual_mode=0
  242. let g:multi_cursor_exit_from_insert_mode=0
  243. Plug 'dag/vim-fish'
  244. " live preview Markdown"
  245. Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
  246. let g:instant_markdown_autostart = 0
  247. let g:instant_markdown_port = 8888
  248. " Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
  249. " let g:mkdp_auto_start = 1
  250. " let g:mkdp_browser = 'firefox'
  251. " let g:mkdp_echo_preview_url = 1
  252. " git helper
  253. Plug 'tpope/vim-fugitive'
  254. " auto reload file
  255. Plug 'djoshea/vim-autoread'
  256. " Plug 'mustache/vim-mustache-handlebars'
  257. " Plug 'trapd00r/vim-syntax-vidir-ls'
  258. Plug 'calviken/vim-gdscript3'
  259. " display hex colors in Vim
  260. " Plug 'RRethy/vim-hexokinase'
  261. Plug 'junegunn/goyo.vim'
  262. " prevent commands being executed through modelines "
  263. Plug 'ciaranm/securemodelines/'
  264. " different colors for each layer of surrounding brackets
  265. Plug 'luochen1990/rainbow'
  266. let g:rainbow_active = 1
  267. " easy custom text objects
  268. Plug 'kana/vim-textobj-user'
  269. " latex custom text objects
  270. Plug 'rbonvall/vim-textobj-latex'
  271. " swap words
  272. Plug 'tommcdo/vim-exchange'
  273. " Plug 'scrooloose/nerdtree'
  274. " let NERDTreeQuitOnOpen=1
  275. " let NERDTreeShowHidden=1
  276. " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  277. " Plug 'junegunn/fzf.vim'
  278. Plug 'christoomey/vim-tmux-navigator'
  279. " mappings [[[ "
  280. let g:tmux_navigator_no_mappings = 1
  281. nnoremap <A-j> :TmuxNavigateDown<cr>
  282. nnoremap <A-k> :TmuxNavigateUp<cr>
  283. nnoremap <A-h> :TmuxNavigateLeft<cr>
  284. nnoremap <A-l> :TmuxNavigateRight<cr>
  285. " nnoremap <C-Down> :TmuxNavigateDown<cr>
  286. " nnoremap <C-Up> :TmuxNavigateUp<cr>
  287. " nnoremap <C-Left> :TmuxNavigateLeft<cr>
  288. " nnoremap <C-Right> :TmuxNavigateRight<cr>
  289. " ]]] mappings "
  290. " highlight multiple words
  291. " TODO: mapping conflicts "
  292. " Plug 'inkarkat/vim-mark'
  293. " Plug 'jceb/vim-orgmode'
  294. " let g:org_todo_keywords=['TODO', 'STARTED', '|', 'DONE']
  295. Plug 'junegunn/vim-easy-align'
  296. " Start interactive EasyAlign in visual mode (e.g. vipga)
  297. xmap ga <Plug>(EasyAlign)
  298. " Start interactive EasyAlign for a motion/text object (e.g. gaip)
  299. nmap ga <Plug>(EasyAlign)
  300. Plug 'wlangstroth/vim-racket'
  301. Plug 'neovimhaskell/haskell-vim'
  302. Plug 'masukomi/vim-markdown-folding'
  303. autocmd FileType markdown set foldexpr=NestedMarkdownFolds()
  304. Plug 'cespare/vim-toml'
  305. Plug 'dpelle/vim-LanguageTool'
  306. " increment dates with C-a
  307. Plug 'tpope/vim-speeddating'
  308. Plug 'martinda/Jenkinsfile-vim-syntax'
  309. Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
  310. let g:go_fmt_command = ""
  311. Plug 'buoto/gotests-vim'
  312. Plug 'tomlion/vim-solidity'
  313. Plug 'jparise/vim-graphql'
  314. Plug 'maxmellon/vim-jsx-pretty'
  315. Plug 'mlaursen/vim-react-snippets', { 'branch': 'main' }
  316. Plug 'cristianoliveira/vim-react-html-snippets'
  317. Plug 'jidn/vim-dbml'
  318. " ]]] vim-plug "
  319. " Mappings [[[ "
  320. call plug#end()
  321. {{ if .gui }}
  322. colorscheme wal
  323. {{ else }}
  324. colorscheme gotham256
  325. {{ end }}
  326. " normal mappings [[[ "
  327. nnoremap <ScrollWheelUp> <C-U>
  328. nnoremap <ScrollWheelDown> <C-D>
  329. nnoremap Y yy
  330. " visual select across lines by default "
  331. nnoremap v <C-V>
  332. " last macro "
  333. nnoremap Q @@
  334. " toggle fold "
  335. nnoremap , za
  336. " jump to horizontal position for mark "
  337. nnoremap ' `
  338. " indenting
  339. nnoremap > >>
  340. nnoremap < <<
  341. inoremap << <Esc><<A
  342. " ]]] normal mappings "
  343. " leader mappings [[[ "
  344. let mapleader="\<Space>"
  345. " find alias
  346. nnoremap <leader>a /^ <Left>
  347. nnoremap <leader>ac :.s/\(\w\w\)/\u\1\U\2/g<CR>
  348. " replace until end of line
  349. nnoremap <leader>c c$
  350. " delete until end of line
  351. nnoremap <leader>d d$
  352. " delete entire buffer
  353. nnoremap <leader>dg ggdG
  354. " delete entire line
  355. nnoremap <leader>dl 0d$
  356. " delete lines matching pattern
  357. " nnoremap <leader>dls :g//d<left><left>
  358. nnoremap <leader>dls q:ig//d<left><left>
  359. " show docstring for cur word
  360. nnoremap <leader>do :YcmCompleter GetDoc<CR>
  361. " delete line into system clipboard
  362. nnoremap <leader>D "+dd
  363. " delete entire buffer into system clipboard
  364. nnoremap <leader>DA "+ggdG
  365. " find copied text
  366. nnoremap <leader>f q/p<CR>
  367. " find merge conflicts
  368. nnoremap <leader>fc /[<>=\|]\{7\}<CR>
  369. " reload folds
  370. nnoremap <leader>fmi :set foldmethod=indent<CR> zM
  371. nnoremap <leader>fmm :set foldmethod=marker<CR> zM
  372. " add marker foldmethod modeline
  373. nnoremap <leader>fi :YcmCompleter FixIt<CR>
  374. " check filetype
  375. nnoremap <leader>ft :se ft?<CR>
  376. " check todo's
  377. nnoremap <leader>ftd /TODO<CR>
  378. " nnoremap <leader>g :YcmCompleter GoTo<CR>
  379. nnoremap <leader>g :vs \| YcmCompleter GoTo<CR>
  380. " nnoremap <leader>gb <C-O>
  381. nnoremap <leader>gb :Git blame<CR>
  382. " vimdiff split
  383. nnoremap <leader>gd :Gvdiff
  384. nnoremap <leader>gdh :Gvdiff HEAD^
  385. nnoremap <leader>gdm :Gvdiff master<CR>
  386. nnoremap <leader>gdo :Gvdiff orig/master<CR>
  387. " toggle search highlighting
  388. nnoremap <leader>h :set hlsearch! hlsearch?<CR>
  389. " help
  390. nnoremap <leader>he :vert help
  391. nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
  392. nnoremap <leader>vhe :vert help
  393. " don't add space when joining lines "
  394. " nnoremap <leader>j gJ
  395. " jump forward
  396. nnoremap <leader>j <C-I>
  397. " join all paragraphs into single line "
  398. nnoremap <leader>jl :set tw=9999999<CR>gggqG
  399. " jump back
  400. nnoremap <leader>k <C-O>
  401. " format current line
  402. nnoremap <leader>l Vgq
  403. " format this and next line
  404. nnoremap <leader>ll Vjgq
  405. " move cursor to middle of line
  406. " nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
  407. nnoremap <leader>m :vert Man
  408. " apply normal command to selection
  409. vnoremap <leader>n q:anorm
  410. " turn off autoformat"
  411. nnoremap <leader>na :set spell spelllang=en_us formatoptions=cjMqtvw<CR>
  412. nnoremap <leader>nt :NERDTree<CR>
  413. " check if in neovim
  414. nnoremap <leader>nv :echo has('nvim')<CR>
  415. " don't wrap lines
  416. nnoremap <leader>nw :set nowrap<CR>
  417. " recursively open fold
  418. nnoremap <leader>o zO
  419. " paste from?
  420. " nnoremap <leader>p "*p
  421. " format paragraph
  422. nnoremap <leader>p gqip
  423. " Plug commands
  424. nnoremap <leader>pli :PlugInstall<CR>
  425. nnoremap <leader>plc :PlugClean<CR>
  426. nnoremap <leader>plu :PlugUpdate<CR>
  427. " don't break lines
  428. nnoremap <leader>py :set tw=0<CR>
  429. " replace in next x lines
  430. " nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
  431. " replace in line
  432. nnoremap <leader>r q:i.s///g<left><left><left>
  433. " replace in visual selection
  434. vnoremap <leader>r q:is///g<ESC>3ha
  435. " replace in entire file
  436. " nnoremap <leader>R q:i%s///g<ESC>2F/i
  437. nnoremap <leader>ra q:i%s///g<ESC>2F/i
  438. " remove italics tags
  439. nnoremap <leader>rmi :%s/<\/\?i>//g<CR>
  440. nnoremap <leader>rn :YcmCompleter RefactorRename
  441. nnoremap <leader>rs :res
  442. " reload vim config
  443. nnoremap <leader>rv :source $MYVIMRC<CR>
  444. vnoremap <leader>s :sort<CR>
  445. nnoremap <leader>sc :set spell spelllang=en_us<CR>
  446. " run current file in shell
  447. nnoremap <leader>sh :!%:p
  448. " sort lines until end of file
  449. nnoremap <leader>so q:i.,$sort<CR>
  450. " vertical split "
  451. nnoremap <leader>sp :sp
  452. " sort lines
  453. nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
  454. " set syntax to shell (for dotfiles)
  455. nnoremap <leader>sys :set syn=sh<CR>
  456. vnoremap <leader>t :!tac<CR>
  457. " capitalize letter
  458. nnoremap <leader>u vU
  459. " comment visual block
  460. " nnoremap <leader>vcc V<leader>cc
  461. " uncomment visual block
  462. " nnoremap <leader>vcu V<leader>cu
  463. " horizontal split "
  464. nnoremap <leader>vs :vs
  465. " open vimrc in vertical split
  466. nnoremap <leader>vv :vsp ~/.vimrc<CR>
  467. " copy next thing to system clipboard
  468. " nnoremap <leader>y "+
  469. " nnoremap <leader>Y "+Y
  470. nnoremap <leader>y y$
  471. nnoremap <leader>yo :Goyo<CR>
  472. " yank entire buffer
  473. nnoremap <leader>yg ggyG
  474. " toggle fold
  475. nnoremap <leader>z za
  476. " close all folds
  477. nnoremap <leader>zm zM
  478. " open all folds
  479. nnoremap <leader>zr zR
  480. " ]]] leader mappings "
  481. " function keys [[[ "
  482. map <F3> :wa<CR>
  483. map <F4> :xa<CR>
  484. map <F5> :q!<CR>
  485. map <F6> :qa!<CR>
  486. map <F7> :AutoSaveToggle<CR>
  487. " reload file
  488. nnoremap <F9> :e<CR>
  489. nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
  490. nnoremap <F11> :set paste<CR>"*p:set nopaste<CR>
  491. " ]]] function keys "
  492. map <S-Enter> O<ESC>
  493. " swap text visually
  494. vnoremap <C-P> <Esc>`.``gvP``P
  495. ino <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
  496. " splits [[[ "
  497. nnoremap <C-Down> <C-W><C-J>
  498. nnoremap <C-Up> <C-W><C-K>
  499. nnoremap <C-Right> <C-W><C-L>
  500. nnoremap <C-Left> <C-W><C-H>
  501. " Maximize height/width.
  502. nnoremap <C-g> <C-W>_
  503. nnoremap <C-w> <C-W>|
  504. " ]]] splits "
  505. " ]]] Mappings "
  506. " Local Mappings [[[ "
  507. let maplocalleader="\\"
  508. " tex [[[ "
  509. autocmd Filetype tex noremap i$ :<C-u>normal! T$vt$<CR>
  510. autocmd Filetype tex noremap i$ :normal vi$<CR>
  511. autocmd Filetype tex xnoremap a$ :<C-u> normal!F$vf$<CR>
  512. autocmd Filetype tex onoremap a$ :normal va$<CR>
  513. autocmd Filetype tex inoremap <localleader>bt \bowtie
  514. autocmd Filetype tex inoremap <localleader>c \checkmark
  515. autocmd Filetype tex inoremap <localleader>d \div
  516. autocmd Filetype tex inoremap <localleader>D \Delta
  517. autocmd Filetype tex inoremap <localleader>e \exists
  518. autocmd Filetype tex inoremap <localleader>ep \epsilon
  519. autocmd Filetype tex inoremap <localleader>fa \forall
  520. autocmd Filetype tex inoremap <localleader>g \geq
  521. autocmd Filetype tex inoremap <localleader>i \in
  522. autocmd Filetype tex inoremap <localleader>la \leftarrow
  523. autocmd Filetype tex inoremap <localleader>le \leq
  524. autocmd Filetype tex inoremap <localleader>ln \log n
  525. autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
  526. autocmd Filetype tex inoremap <localleader>m \mu
  527. " autocmd Filetype tex inoremap <localleader>n \neg
  528. autocmd Filetype tex inoremap <localleader>n \neq
  529. autocmd Filetype tex inoremap <localleader>N \mathbb{N}
  530. autocmd Filetype tex inoremap <localleader>pg \pagebreak<Enter>
  531. autocmd Filetype tex inoremap <localleader>ph [,phantom]
  532. autocmd Filetype tex inoremap <localleader>q \qquad
  533. autocmd Filetype tex inoremap <localleader>r \rightarrow
  534. autocmd Filetype tex inoremap <localleader>R \Rightarrow
  535. " autocmd Filetype tex inoremap <localleader>s \subset
  536. autocmd Filetype tex inoremap <localleader>s \text{s}
  537. autocmd Filetype tex inoremap <localleader>st such that
  538. autocmd Filetype tex inoremap <localleader>S \Sigma
  539. autocmd Filetype tex inoremap <localleader>t \times
  540. " autocmd Filetype tex inoremap <localleader>T $T$
  541. autocmd Filetype tex inoremap <localleader>T \Theta
  542. " replace bars/underscores in URL
  543. autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
  544. autocmd Filetype tex inoremap <localleader>v \vee
  545. autocmd Filetype tex inoremap <localleader>w \wedge
  546. autocmd Filetype tex inoremap <localleader>x $x$-axis
  547. autocmd Filetype tex inoremap <localleader>y $y$-axis
  548. autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
  549. " par3
  550. autocmd Filetype tex inoremap <localleader>wx $w(x)$
  551. autocmd Filetype tex inoremap <localleader>tx $t(x)$
  552. " ]]] tex "
  553. autocmd Filetype c inoremap <localleader>uc unsigned char
  554. autocmd BufNewFile,BufRead *.h nnoremap <localleader>x 0iextern <Esc>f{hc$;<Esc>
  555. autocmd BufNewFile,BufRead ~/.habitctl/log nnoremap <localleader>d Gy3kGp5e<C-V>3j<C-a>$rnj.j.j$.
  556. autocmd BufNewFile,BufRead ~/.habitctl/log nnoremap <localleader>n $rn
  557. autocmd BufNewFile,BufRead ~/.habitctl/log nnoremap <localleader>y $ry
  558. autocmd Filetype fish inoremap <localleader>1 $argv[1]
  559. autocmd Filetype fish inoremap <localleader>2 $argv[2]
  560. autocmd Filetype javascript inoremap <localleader>x process.exit()
  561. autocmd Filetype markdown inoremap <localleader>c - [ ]
  562. autocmd Filetype markdown nnoremap <localleader>e 0f[lr<Space>
  563. autocmd Filetype markdown inoremap <localleader>t TODO:
  564. autocmd Filetype markdown vnoremap <localleader>r q:is/\[x/[ /g<Esc><CR>:set nohlsearch<CR>
  565. autocmd Filetype markdown vnoremap <localleader>x q:is/\[ /[x/g<Esc><CR>:set nohlsearch<CR>
  566. autocmd Filetype markdown nnoremap <localleader>x 0f[lrx
  567. " nnoremap <localleader>x 0f[lrx
  568. autocmd Filetype go nnoremap <localleader>f :GoTestFunc<CR>
  569. autocmd Filetype go nnoremap <localleader>l :GoLint<CR>
  570. autocmd Filetype go nnoremap <localleader>m :GoTests<CR>
  571. autocmd Filetype go nnoremap <localleader>r yawq:iGoRename <Esc>p
  572. autocmd Filetype go nnoremap <localleader>t :GoTest<CR>
  573. autocmd Filetype go-template inoremap <localleader>e {{"{{ else }}"}}
  574. autocmd Filetype go-template inoremap <localleader>hd {{"{{ .chezmoi.homeDir }}"}}
  575. autocmd Filetype go-template nnoremap <localleader>fp :%s/{{"{{{"}}/[[[/g<CR>:%s/}}}/]]]/g<CR>
  576. autocmd Filetype Jenkinsfile nnoremap <localleader>q :.s/"/'/g<CR>
  577. autocmd Filetype Jenkinsfile vnoremap <localleader>q :s/"/'/g<CR>
  578. autocmd Filetype python inoremap <localleader>bp breakpoint()
  579. autocmd Filetype python inoremap <localleader>ip from pprint import pprint
  580. autocmd Filetype python inoremap <localleader>s self.
  581. " ]]] Local Mappings "
  582. " vim: fdm=marker ft=vim.go-template