" --------- MAPPINGS FOR QUICK CONFIG EDITS --------- " mnemonic: (e)dit (v)imrc nmap ev :tabedit $MYVIMRC " mnemonic: (e)dit (t)mux.conf nmap et :tabedit ~/.tmux.conf " mnemonic: (e)dit (g)oogle.vim nmap eg :tabedit ~/.vim/prefs/google.vim " mnemonic: (e)dit (b)ash_profile nmap eb :tabedit ~/.bash_profile " mnemonic: (e)dit (f)tplugin nmap ef :tabedit ~/.vim/after/ftplugin " mnemonic: (e)dit (p)lugins nmap ep :tabedit ~/.vim/prefs/plugins.vim " mnemonic: (e)dit (c)onfigs * opens NERDTree on the prefs dir nmap ec :tabedit ~/.vim/prefs/ " mnemonic: (e)dit (p)refs, (i)nit.vim nmap epi :tabedit ~/.vim/prefs/init.vim " mnemonic: (e)dit (p)refs, (l)eader.vim nmap epl :tabedit ~/.vim/prefs/leader.vim " mnemonic: (e)dit (p)refs, (c)oc.vim nmap epc :tabedit ~/.vim/prefs/coc.vim " mnemonic: (e)dit (p)refs, (m)appings.vim nmap epm :tabedit ~/.vim/prefs/mappings.vim " mnemonic: (e)dit (p)refs, (p)lug_prefs.vim nmap epp :tabedit ~/.vim/prefs/plug_prefs.vim " mnemonic: (e)dit (p)refs, (u)i.vim nmap epu :tabedit ~/.vim/prefs/ui.vim " " mnemonic: (e)dit (p)refs, (g)olang.vim nmap epg :tabedit ~/.vim/prefs/google.vim " mnemonic: (e)dit (z)shrc nmap ez :tabedit ~/.zshrc " " mnemonic: (i)nsert (l)ambda imap il l* " HEX<->ASCII " mnemonic: (h)ex (t)o (a)scii vnoremap hta :s/\%V\x\x/\=nr2char(printf("%d", "0x".submatch(0)))/g`< " mnemonic: (a)scii (t)o (h)ex vnoremap ath :s/\%V./\=printf("%x",char2nr(submatch(0)))/g`< let g:windowswap_map_keys = 0 "prevent default bindings nnoremap yw :call WindowSwap#MarkWindowSwap() " --------- SURROUND MAPPINGS --------- " " Surround a word with "quotes" map " ysiw" vmap " c""" " ' Surround a word with 'single quotes' map ' ysiw' vmap ' c'"' " ' Surround a word with 'ticks' map ` ysiw` vmap ` c`"` " --------- SEARCH MAPPINGS --------- " unhilight search nnoremap :nohlsearch " EZ Ack search " nnoremap a :Ack! " nnoremap A :Ack! " --------- CLIPBOARD MAPPINGS --------- " Paste from OS clipboard map v i"+pa vmap v c"+p imap v "+pa " Copy to OS clipboard " vnoremap y "yy :call system('xclip', @y) map y !xclip -selection clipboard vmap y !xclip -selection clipboard " map y "+Y " vmap y "+y " --------- WINDOW/PANE MAPPINGS --------- map wr r map H :wincmd H map K :wincmd K map L :wincmd L map J :wincmd J map x :wincmd x " resize vertical split to 1/3 or 2/3 size nnoremap s+ :exe "vertical resize " . (winwidth(0) * 5/4) nnoremap s- :exe "vertical resize " . (winwidth(0) * 4/5) " resize horizontal split to 1/3 or 2/3 size nnoremap x+ :exe "resize " . (winheight(0) * 3/2) nnoremap x- :exe "resize " . (winheight(0) * 2/3) " --------- FORMATTING MAPPINGS --------- " indent file map = gg=G `` " format HTML/JSON map fh :%s/>\s*\r map fj :%!python -m json.tool map fjs :call UnMinify() "command! UnMinify call UnMinify() function! UnMinify() %s/{\ze[^\r\n]/{\r/g %s/){/) {/g %s/};\?\ze[^\r\n]/\0\r/g %s/;\ze[^\r\n]/;\r/g %s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g normal ggVG= endfunction nmap toi :CocCommand tsserver.organizeImports " --------- FUGITIVE MAPPINGS --------- nmap dg :diffget nmap dp :diffput nmap du :diffupdate vmap dg :diffget vmap dp :diffput vmap du :diffupdate nmap giw :Gwrite nmap gic :Gcommit -v nmap gid :Gdiff nmap gis :Gstatus "" --------- NERD Commenter " Create default mappings let g:NERDCreateDefaultMappings = 0 " Add spaces after comment delimiters by default let g:NERDSpaceDelims = 1 " Use compact syntax for prettified multi-line comments let g:NERDCompactSexyComs = 1 " Align line-wise comment delimiters flush left instead of following code indentation let g:NERDDefaultAlign = 'left' " Set a language to use its alternate delimiters by default let g:NERDAltDelims_java = 1 " Allow commenting and inverting empty lines (useful when commenting a region) let g:NERDCommentEmptyLines = 1 " Enable trimming of trailing whitespace when uncommenting let g:NERDTrimTrailingWhitespace = 1 "Enable NERDCommenterToggle to check all selected lines is commented or not let g:NERDToggleCheckAllLines = 1 nnoremap c :call nerdcommenter#Comment(0,"toggle") vnoremap c :call nerdcommenter#Comment(0,"toggle") nnoremap c$ :call nerdcommenter#Comment(0,"ToEOL") vnoremap c$ :call nerdcommenter#Comment(0,"ToEOL") nmap yf :let @" = expand("%") nmap ut :UndotreeToggle