From 98dc5a76e915c7d1c865a2a9adc8c37c91b82d2a Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 5 Aug 2014 06:01:38 -0400 Subject: [PATCH] ctrl-A aligns comments and ctrl-a aligns end of line comments --- vim/config/keyboard.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index dbc8800..c336c2e 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -162,6 +162,10 @@ " F | (N) -> format document using :Autoformat " w | (N) -> remove whitespace " t | (N) -> convert tabs into spaces +" A | (N) -> aligns all comments +" A | (V) -> aligns selected comments +" a | (N) -> aligns all comments after text +" a | (V) -> aligns selected comments after text " | (V) -> indent all the lines currently selected " | (N) -> indent the current line " | (V) -> unindent all the lines currently selected @@ -199,9 +203,7 @@ " " (selection) " | (N) -> select all text -" a | (N) -> select all text " | (V) -> select all text -" a | (V) -> select all text " " | (V) -> select all text above " | (V) -> select all text below @@ -562,6 +564,10 @@ nnoremap F ':Autoformat:echo "The document has been formatted with :Autoformat"' nnoremap w ':FixWhitespace:echo "Trailing whitespace has been removed"' nnoremap t ':retab:noh:echo "Tabs have been converted to spaces"' + nnoremap A :exe "%Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*' + vnoremap A :exe "'<,'>Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*' + nnoremap a :exe "%Tabular" '/^\ *[^'.matchstr(&commentstring, '[^%]*').'\ ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*' + vnoremap a :exe "'<,'>Tabular" '/^\ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*' "tab and untab the currently selected lines vnoremap >gv @@ -613,11 +619,9 @@ "} "SELECTION:{ - "ctrl-a to select all (and an alt for screen users) + "ctrl-a to select all nnoremap gg0vG$ xnoremap gg0vG$ - nnoremap a gg0vG$ - xnoremap a gg0vG$ "map remap keys for speedier text selection xnoremap 4k