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.

648 lines
20 KiB

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