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.

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