From c58b393f617b55677b7d2fe23c8f2c1de3e48827 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:12:11 +1200 Subject: Make comments on leader mappings more legible More abstracted, too. Who knows if I'll keep using backslash? --- vim/vimrc | 110 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 369962a7..e431e38e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1053,174 +1053,174 @@ nmap ] (PutBlankLinesBelow) let mapleader = '\' let maplocalleader = ',' -" \a toggles 'formatoptions' 'a' flag using a plugin +" Leader,a toggles 'formatoptions' 'a' flag using a plugin nnoremap a :ToggleFlagLocal formatoptions a -" \b toggles settings friendly to copying and pasting +" Leader,b toggles settings friendly to copying and pasting nmap b (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 c :setlocal cursorline! cursorline? -" \C toggles 'cursorcolumn'; works in visual mode +" Leader,C toggles 'cursorcolumn'; works in visual mode nnoremap C :setlocal cursorcolumn! cursorcolumn? xnoremap C :setlocal cursorcolumn! cursorcolumn?gv -" \d inserts the local date (POSIX date) +" Leader,d inserts the local date (POSIX date) nnoremap d :read !date -" \D inserts the UTC date (POSIX date) +" Leader,D inserts the UTC date (POSIX date) nnoremap D :read !date -u -" \e forces a buffer to be editable +" Leader,e forces a buffer to be editable nnoremap e :setlocal modifiable noreadonly -" \f shows the current 'formatoptions' at a glance +" Leader,f shows the current 'formatoptions' at a glance nnoremap f :setlocal formatoptions? -" \F reloads filetype plugins +" Leader,F reloads filetype plugins nnoremap F :FileTypeReload -" \g shows the current file's fully expanded path +" Leader,g shows the current file's fully expanded path nnoremap g :echo expand('%:p') -" \G changes directory to the current file's location +" Leader,G changes directory to the current file's location nnoremap G :cd %:hpwd -" \h toggles highlighting search results +" Leader,h toggles highlighting search results nnoremap h :set hlsearch! hlsearch? -" \H shows command history +" Leader,H shows command history nnoremap H :history : -" \i toggles showing matches as I enter my pattern +" Leader,i toggles showing matches as I enter my pattern nnoremap i :set incsearch! incsearch? -" \j jumps to buffers ("jetpack") +" Leader,j jumps to buffers ("jetpack") nnoremap j :buffers:buffer -" \k shows my marks +" Leader,k shows my marks nnoremap k :marks -" \l toggles showing tab, end-of-line, and trailing white space +" Leader,l toggles showing tab, end-of-line, and trailing white space nnoremap l :setlocal list! list? xnoremap l :setlocal list! list?gv -" \L toggles 'colorcolumn' showing 'textwidth' +" Leader,L toggles 'colorcolumn' showing 'textwidth' nnoremap L :ToggleFlagLocal colorcolumn +1 xnoremap L :ToggleFlagLocal colorcolumn +1gv -" \m shows normal maps +" Leader,m shows normal maps nnoremap m :map -" \M shows buffer-local normal maps +" Leader,M shows buffer-local normal maps nnoremap M :map -" \n toggles line number display +" Leader,n toggles line number display nnoremap n :setlocal number! number? xnoremap n :setlocal number! number?gv -" \N toggles position display in bottom right +" Leader,N toggles position display in bottom right nnoremap N :set ruler! ruler? xnoremap N :set ruler! ruler?gv -" \o opens a line below in paste mode +" Leader,o opens a line below in paste mode nmap o (PasteOpenBelow) -" \O opens a line above in paste mode +" Leader,O opens a line above in paste mode nmap O (PasteOpenAbove) -" \p toggles paste mode +" Leader,p toggles paste mode nnoremap p :set paste! paste? -" \P creates the path to the current file +" Leader,P creates the path to the current file nnoremap P :call mkdir(expand('%:h'), 'p') -" \q formats the current paragraph +" Leader,q formats the current paragraph nnoremap q gqap -" \r acts as a replacement operator +" Leader,r acts as a replacement operator nmap r (ReplaceOperator) xmap r (ReplaceOperator) -" \R reloads ~/.vimrc +" Leader,R reloads ~/.vimrc nnoremap R :source $MYVIMRC -" \s toggles spell checking +" Leader,s toggles spell checking nnoremap s :setlocal spell! spell? -" \S shows loaded scripts +" Leader,S shows loaded scripts nnoremap S :scriptnames -" \t shows current filetype +" Leader,t shows current filetype nnoremap t :setlocal filetype? -" \T clears filetype +" Leader,T clears filetype nnoremap T :setlocal filetype= -" \u sets US English spelling (compare \z) +" Leader,u sets US English spelling (compare Leader,z) nnoremap u :setlocal spelllang=en_us -" \v shows all global variables +" Leader,v shows all global variables nnoremap v :let g: v: -" \V shows all local variables +" Leader,V shows all local variables nnoremap V :let b: t: w: -" \w toggles wrapping +" Leader,w toggles wrapping nnoremap w :setlocal wrap! wrap? xnoremap w :setlocal wrap! wrap?gv -" \x strips trailing whitespace via a custom plugin +" Leader,x strips trailing whitespace via a custom plugin nnoremap x :StripTrailingWhitespace xnoremap x :StripTrailingWhitespace -" \X squeezes repeated blank lines via a custom plugin +" Leader,X squeezes repeated blank lines via a custom plugin nnoremap X :SqueezeRepeatBlanks xnoremap X :SqueezeRepeatBlanks -" \y shows all registers +" Leader,y shows all registers nnoremap y :registers -" \z sets NZ English spelling (compare \u) +" Leader,z sets NZ English spelling (compare Leader,u) nnoremap z :setlocal spelllang=en_nz -" \= runs the whole buffer through =, preserving position +" Leader,= runs the whole buffer through =, preserving position nnoremap = :KeepPosition normal! 1G=G -" \+ runs the whole buffer through gq, preserving position +" Leader,+ runs the whole buffer through gq, preserving position nnoremap + :KeepPosition normal! 1GgqG -" \. runs the configured make program into the location list +" Leader,. runs the configured make program into the location list nnoremap . :lmake! -" \< and \> adjust indent of last edit; good for pasting +" Leader,< and Leader,> adjust indent of last edit; good for pasting nnoremap :'[,'] nnoremap > :'[,']> -" \_ uses last changed or yanked text as an object +" Leader,_ uses last changed or yanked text as an object onoremap _ :normal! `[v`] -" \% uses entire buffer as an object +" Leader,% uses entire buffer as an object onoremap % :normal! 1GVG -" \{ 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 { (VerticalRegionUp) sunmap { map } (VerticalRegionDown) sunmap } -" \/ types :vimgrep for me ready to enter a search pattern +" Leader,/ types :vimgrep for me ready to enter a search pattern nnoremap / :vimgrep /\c/j ** -" \? types :lhelpgrep for me ready to enter a search pattern +" Leader,? types :lhelpgrep for me ready to enter a search pattern nnoremap ? :lhelpgrep \c -" \* escapes regex metacharacters +" Leader,* escapes regex metacharacters nmap * (RegexEscape) xmap * (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 \ `" xnoremap \ `" -" \DEL deletes the current buffer +" Leader,DEL deletes the current buffer nnoremap :bdelete -" \INS edits a new buffer +" Leader,INS edits a new buffer nnoremap :enew -" \TAB toggles 'autoindent' +" Leader,TAB toggles 'autoindent' nnoremap :setlocal autoindent! autoindent? " Some useful abbreviations -- cgit v1.2.3