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.

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