diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 00:12:11 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 00:12:11 +1200 |
commit | c58b393f617b55677b7d2fe23c8f2c1de3e48827 (patch) | |
tree | 3e46850a8d03e564d87e79fb3c88c14e94f35b59 | |
parent | Document insert mode CTRL-K double-tap mapping (diff) | |
download | dotfiles-c58b393f617b55677b7d2fe23c8f2c1de3e48827.tar.gz dotfiles-c58b393f617b55677b7d2fe23c8f2c1de3e48827.zip |
Make comments on leader mappings more legible
More abstracted, too. Who knows if I'll keep using backslash?
-rw-r--r-- | vim/vimrc | 110 |
1 files changed, 55 insertions, 55 deletions
@@ -1053,174 +1053,174 @@ nmap ]<Space> <Plug>(PutBlankLinesBelow) let mapleader = '\' let maplocalleader = ',' -" \a toggles 'formatoptions' 'a' flag using a plugin +" Leader,a toggles 'formatoptions' 'a' flag using a plugin nnoremap <Leader>a :<C-U>ToggleFlagLocal formatoptions a<CR> -" \b toggles settings friendly to copying and pasting +" Leader,b toggles settings friendly to copying and pasting nmap <Leader>b <Plug>(CopyLinebreakToggle) -" \c toggles 'cursorline'; no visual mode map as it doesn't work +" Leader,c toggles 'cursorline'; no visual mode map as it doesn't work nnoremap <Leader>c :<C-U>setlocal cursorline! cursorline?<CR> -" \C toggles 'cursorcolumn'; works in visual mode +" Leader,C toggles 'cursorcolumn'; works in visual mode nnoremap <Leader>C :<C-U>setlocal cursorcolumn! cursorcolumn?<CR> xnoremap <Leader>C :<C-U>setlocal cursorcolumn! cursorcolumn?<CR>gv -" \d inserts the local date (POSIX date) +" Leader,d inserts the local date (POSIX date) nnoremap <Leader>d :read !date<CR> -" \D inserts the UTC date (POSIX date) +" Leader,D inserts the UTC date (POSIX date) nnoremap <Leader>D :read !date -u<CR> -" \e forces a buffer to be editable +" Leader,e forces a buffer to be editable nnoremap <Leader>e :<C-U>setlocal modifiable noreadonly<CR> -" \f shows the current 'formatoptions' at a glance +" Leader,f shows the current 'formatoptions' at a glance nnoremap <Leader>f :<C-U>setlocal formatoptions?<CR> -" \F reloads filetype plugins +" Leader,F reloads filetype plugins nnoremap <Leader>F :<C-U>FileTypeReload<CR> -" \g shows the current file's fully expanded path +" Leader,g shows the current file's fully expanded path nnoremap <Leader>g :<C-U>echo expand('%:p')<CR> -" \G changes directory to the current file's location +" Leader,G changes directory to the current file's location nnoremap <Leader>G :<C-U>cd %:h<Bar>pwd<CR> -" \h toggles highlighting search results +" Leader,h toggles highlighting search results nnoremap <Leader>h :<C-U>set hlsearch! hlsearch?<CR> -" \H shows command history +" Leader,H shows command history nnoremap <Leader>H :<C-U>history :<CR> -" \i toggles showing matches as I enter my pattern +" Leader,i toggles showing matches as I enter my pattern nnoremap <Leader>i :<C-U>set incsearch! incsearch?<CR> -" \j jumps to buffers ("jetpack") +" Leader,j jumps to buffers ("jetpack") nnoremap <Leader>j :<C-U>buffers<CR>:buffer<Space> -" \k shows my marks +" Leader,k shows my marks nnoremap <Leader>k :<C-U>marks<CR> -" \l toggles showing tab, end-of-line, and trailing white space +" Leader,l toggles showing tab, end-of-line, and trailing white space nnoremap <Leader>l :<C-U>setlocal list! list?<CR> xnoremap <Leader>l :<C-U>setlocal list! list?<CR>gv -" \L toggles 'colorcolumn' showing 'textwidth' +" Leader,L toggles 'colorcolumn' showing 'textwidth' nnoremap <Leader>L :<C-U>ToggleFlagLocal colorcolumn +1<CR> xnoremap <Leader>L :<C-U>ToggleFlagLocal colorcolumn +1<CR>gv -" \m shows normal maps +" Leader,m shows normal maps nnoremap <Leader>m :<C-U>map<CR> -" \M shows buffer-local normal maps +" Leader,M shows buffer-local normal maps nnoremap <Leader>M :<C-U>map <buffer><CR> -" \n toggles line number display +" Leader,n toggles line number display nnoremap <Leader>n :<C-U>setlocal number! number?<CR> xnoremap <Leader>n :<C-U>setlocal number! number?<CR>gv -" \N toggles position display in bottom right +" Leader,N toggles position display in bottom right nnoremap <Leader>N :<C-U>set ruler! ruler?<CR> xnoremap <Leader>N :<C-U>set ruler! ruler?<CR>gv -" \o opens a line below in paste mode +" Leader,o opens a line below in paste mode nmap <Leader>o <Plug>(PasteOpenBelow) -" \O opens a line above in paste mode +" Leader,O opens a line above in paste mode nmap <Leader>O <Plug>(PasteOpenAbove) -" \p toggles paste mode +" Leader,p toggles paste mode nnoremap <Leader>p :<C-U>set paste! paste?<CR> -" \P creates the path to the current file +" Leader,P creates the path to the current file nnoremap <Leader>P :<C-U>call mkdir(expand('%:h'), 'p')<CR> -" \q formats the current paragraph +" Leader,q formats the current paragraph nnoremap <Leader>q gqap -" \r acts as a replacement operator +" Leader,r acts as a replacement operator nmap <Leader>r <Plug>(ReplaceOperator) xmap <Leader>r <Plug>(ReplaceOperator) -" \R reloads ~/.vimrc +" Leader,R reloads ~/.vimrc nnoremap <Leader>R :<C-U>source $MYVIMRC<CR> -" \s toggles spell checking +" Leader,s toggles spell checking nnoremap <Leader>s :<C-U>setlocal spell! spell?<CR> -" \S shows loaded scripts +" Leader,S shows loaded scripts nnoremap <Leader>S :<C-U>scriptnames<CR> -" \t shows current filetype +" Leader,t shows current filetype nnoremap <Leader>t :<C-U>setlocal filetype?<CR> -" \T clears filetype +" Leader,T clears filetype nnoremap <Leader>T :<C-U>setlocal filetype=<CR> -" \u sets US English spelling (compare \z) +" Leader,u sets US English spelling (compare Leader,z) nnoremap <Leader>u :<C-U>setlocal spelllang=en_us<CR> -" \v shows all global variables +" Leader,v shows all global variables nnoremap <Leader>v :<C-U>let g: v:<CR> -" \V shows all local variables +" Leader,V shows all local variables nnoremap <Leader>V :<C-U>let b: t: w:<CR> -" \w toggles wrapping +" Leader,w toggles wrapping nnoremap <Leader>w :<C-U>setlocal wrap! wrap?<CR> xnoremap <Leader>w :<C-U>setlocal wrap! wrap?<CR>gv -" \x strips trailing whitespace via a custom plugin +" Leader,x strips trailing whitespace via a custom plugin nnoremap <Leader>x :StripTrailingWhitespace<CR> xnoremap <Leader>x :StripTrailingWhitespace<CR> -" \X squeezes repeated blank lines via a custom plugin +" Leader,X squeezes repeated blank lines via a custom plugin nnoremap <Leader>X :SqueezeRepeatBlanks<CR> xnoremap <Leader>X :SqueezeRepeatBlanks<CR> -" \y shows all registers +" Leader,y shows all registers nnoremap <Leader>y :<C-U>registers<CR> -" \z sets NZ English spelling (compare \u) +" Leader,z sets NZ English spelling (compare Leader,u) nnoremap <Leader>z :<C-U>setlocal spelllang=en_nz<CR> -" \= runs the whole buffer through =, preserving position +" Leader,= runs the whole buffer through =, preserving position nnoremap <Leader>= :<C-U>KeepPosition normal! 1G=G<CR> -" \+ runs the whole buffer through gq, preserving position +" Leader,+ runs the whole buffer through gq, preserving position nnoremap <Leader>+ :<C-U>KeepPosition normal! 1GgqG<CR> -" \. runs the configured make program into the location list +" Leader,. runs the configured make program into the location list nnoremap <Leader>. :<C-U>lmake!<CR> -" \< and \> adjust indent of last edit; good for pasting +" Leader,< and Leader,> adjust indent of last edit; good for pasting nnoremap <Leader><lt> :<C-U>'[,']<lt><CR> nnoremap <Leader>> :<C-U>'[,']><CR> -" \_ uses last changed or yanked text as an object +" Leader,_ uses last changed or yanked text as an object onoremap <Leader>_ :<C-U>normal! `[v`]<CR> -" \% uses entire buffer as an object +" Leader,% uses entire buffer as an object onoremap <Leader>% :<C-U>normal! 1GVG<CR> -" \{ and \} move to lines with non-space chars before current column +" Leader,{ and Leader,} move to lines with non-space chars before current column map <Leader>{ <Plug>(VerticalRegionUp) sunmap <Leader>{ map <Leader>} <Plug>(VerticalRegionDown) sunmap <Leader>} -" \/ types :vimgrep for me ready to enter a search pattern +" Leader,/ types :vimgrep for me ready to enter a search pattern nnoremap <Leader>/ :<C-U>vimgrep /\c/j **<S-Left><S-Left><Right> -" \? types :lhelpgrep for me ready to enter a search pattern +" Leader,? types :lhelpgrep for me ready to enter a search pattern nnoremap <Leader>? :<C-U>lhelpgrep \c<S-Left> -" \* escapes regex metacharacters +" Leader,* escapes regex metacharacters nmap <Leader>* <Plug>(RegexEscape) xmap <Leader>* <Plug>(RegexEscape) -" \\ jumps to the last edit position mark, like g;, but works as a motion +" Leader,\ jumps to the last edit position mark, like g;, but works as a motion " "Now, where was I?" (tap-tap) nnoremap <Leader>\ `" xnoremap <Leader>\ `" -" \DEL deletes the current buffer +" Leader,DEL deletes the current buffer nnoremap <Leader><Delete> :bdelete<CR> -" \INS edits a new buffer +" Leader,INS edits a new buffer nnoremap <Leader><Insert> :<C-U>enew<CR> -" \TAB toggles 'autoindent' +" Leader,TAB toggles 'autoindent' nnoremap <Leader><Tab> :<C-U>setlocal autoindent! autoindent?<CR> " Some useful abbreviations |