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.

632 lines
20 KiB

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