"============================================================" " " " Darkcloud Vim Config: keyboard settings " " " " By: Kevin MacMartin (prurigro@gmail.com) " " Website: https://github.com/prurigro/darkcloud-vimconfig " " " " License: MIT " " " "============================================================" " " Note: " *The default key is: \ " " Aliases: " :GitLog & :gitlog | (C) -> show a navigatable log of commit history " :GitDiff & :gitdiff | (C) -> current file and last commit in vimdiff " :GitStatus & :gitstatus | (C) -> shows the output of git status " :GitCommit & :gitcommit | (C) -> commits changes to the current file " :git | (C) -> open a vert split with the file in diff mode " " :vs33 | (C) -> create a vertical split using 33% width " :vs66 | (C) -> create a vertical split using 66% width " :sp33 | (C) -> create a split using 33% of the height " :sp66 | (C) -> create a split using 66% of the height " :diff | (C) -> open a new file in diff mode " " :wsudo & :sudow | (C) -> write the file as root using sudo " :esudo & :sudoe | (C) -> read a file as root using sudo " " :ik | (C) -> add following character to keywords " :iK | (C) -> remove following character from keywords " " Reference: (view plugin documentation for the full list of commands each offers) " | (A) -> comment selection/create an empty comment " b | (A) -> comment the current block(s) " r | (A) -> comment everything on the line to the right " p | (A) -> comment the current paragraph " " (surround) " S" | (V) -> surround selection with quotes " S | (V) -> surround selection " ds" | (N) -> delete surrounding "" " dst | (N) -> delete surrounding tag (ie: ) " cs'" | (N) -> change surrounding '' to "" (any delimiters) " cs" | (N) -> change surrounding "" to the tag: " cst" | (N) -> change any surrounding tag to "" " ysiw' | (N) -> surround the current word with '' " yss' | (N) -> surround non-whitespace of current line with '' " " Mappings: " (mouse) " | (A) -> scroll right " | (A) -> scroll right " | (A) -> scroll left " | (A) -> scroll left " " | (A) -> selects from the cursor " | (A) -> selects from the cursor " | (A) -> select the line being clicked " | (A) -> select the paragraph being clicked " " | (A) -> copy selection or character under cursor " | (A) -> copy selection or character under cursor " " | (A) -> cut selection or character under cursor " | (A) -> cut selection or character under cursor " " | (A) -> paste at the cursor (not mouse) " | (A) -> paste at the cursor (not mouse) " " | (A) -> paste from xorg paste buffer " " (tabs) " | (N) -> go to the next open tab " | (N) -> go to the previous open tab " | (N) -> open a new tab " | (N) -> create a new tab with vimfiler " | (N) -> create a new tab with a double pane vimfiler " " (split) " { | (N) -> rotate counter-clockwise " } | (N) -> rotate clockwise " ] | (N) -> split vertically " 0 | (N) -> create a vertical split 33% of the window " ) | (N) -> create a vertical split 66% of the window " [ | (N) -> split horizontally " 9 | (N) -> create a horizontal split 33% of the window " ( | (N) -> create a horizontal split 66% of the window " " (display) " | (N) -> reset window and clear search " // | (N) -> reset window and clear search " n | (N) -> center vertically on next search term " N | (N) -> center vertically on last search term " * | (N) -> center vertically on nth next search term " # | (N) -> center vertically on nth last search term " " (toggles and features) " ik | (N) -> add cursor character as a keyword " iK | (N) -> remove cursor character as a keyword " " ~ | (N) -> popup a command reference " , | (N) -> display tag information in echo area " | (N) -> toggle the vim reference manual " ? | (N) -> toggle the vim reference manual " ` | (A) -> toggle the gutter(numbers+folds+signify) " " | (N) -> toggle selected fold " = | (N) -> open all folds " + | (N) -> open all folds " - | (N) -> unopen all folds " _ | (N) -> unopen all folds " 0 | (N) -> reset all folds using default fold level " " | (A) -> toggle extradite git commit history " | (A) -> toggle extradite git commit history " | (A) -> toggle extradite git commit history " } | (N) -> toggle extradite git commit history " | (A) -> toggle the tagbar sidebar " | (A) -> toggle the tagbar sidebar " | (A) -> toggle the tagbar sidebar " { | (N) -> toggle the tagbar sidebar " | (A) -> toggle the gundo sidebar " | (A) -> toggle the gundo sidebar " | (A) -> toggle the gundo sidebar " ] | (N) -> toggle the gundo sidebar " | (A) -> toggle vimfiler sidebar " | (A) -> toggle vimfiler sidebar " | (A) -> toggle vimfiler sidebar " [ | (N) -> toggle vimfiler sidebar " " | (A) -> toggle line wrapping " | (A) -> toggle line wrapping " | (A) -> toggle line wrapping " | (A) -> toggle spell check " | (A) -> toggle spell check " | (A) -> toggle spell check " | (A) -> toggle external-paste mode " | (A) -> toggle external-paste mode " | (A) -> toggle external-paste mode " | (A) -> toggle syntax checking " | (A) -> toggle syntax checking " | (A) -> toggle syntax checking " " ` | (A) -> toggle goyo (distraction-free mode) " " (gvim toggles) " | (A) -> toggle the menubar " | (A) -> toggle the toolbar " | (A) -> toggle the scrollbars " " (spellcheck) " ?+ | (N) -> add the selected word to the local dictionary " ?? | (N) -> show spelling suggestions for selected word " ?N | (N) -> go to the next spelling mistake " ?P | (N) -> go to the previous spelling mistake " " (copy/paste and undo/redo) " p | (N) -> view the paste buffers and register contents " P | (V) -> save selection to the buffer and paste over " p | (V) -> preserve the buffer pasting over selected text " y | (N) -> copy the character the cursor is on " Direction | (N) -> paste in the direction entered " T | (N) -> copy to the end of the line " T | (V) -> copy to the end of the line " " (delete/cut functions) " x | (N) -> delete the char(s) under and the cursor " x | (V) -> delete the currently selected text " X | (N) -> delete the char(s) before the cursor " X | (V) -> delete the currently selected lines " D | (N) -> delete from the cursor to EOL " D | (V) -> delete the currently selected lines " dw | (N) -> delete from the cursor to end of the word " dd | (N) -> delete current line " d | (V) -> delete selected text " " (improved copy and paste shortcuts) " | (N) -> paste from buffer " | (V) -> paste buffer in place of selection " | (I) -> paste from buffer then return to input " | (N) -> copy character " | (V) -> copy selection " | (N) -> cut character " | (V) -> cut selection " | (I) -> cut previous word during input " | (I) -> cut line before cursor during input " | (I) -> paste what's been cut during input " " (autocompletion) " , | (A) -> enter after emmet 'word' (ie: html:5) " | (I) -> (neocomp) close the popup and " | (I) -> (neocomp) select/cycle popup completion " | (I) -> (neocomp) close the popup and " | (I) -> (neocomp) undo the most recent completion " " (formatting) " | (V) -> deletes currently selected text " J | (N) -> split document into lines of tw or 80 " J | (V) -> split selection into lines of tw or 80 " f | (N) -> format document and return to cursor " f | (V) -> format the selection and return to cursor " F | (N) -> format document using :Autoformat " t | (N) -> convert tabs into spaces " T | (N) -> convert spaces into tabs " w | (N) -> remove whitespace " c | (N) -> comment/uncomment current line " c | (V) -> comment/uncomment selection " A | (N) -> aligns comments using the comment symbol " 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) -> indent all the lines currently selected " > | (N) -> indent the current line " | (V) -> un-indent all the lines currently selected " | (N) -> un-indent the current line " < | (V) -> un-indent all the lines currently selected " < | (N) -> un-indent the current line " " (movement) " = | (N) -> go to the first char on the next line " _ | (N) -> go to the first char on the previous line " | (N) -> move to the beginning of the document " | (N) -> move to the end of the document " | (N) -> move to the end of the line " | (N) -> move to the beginning of the non-whitespace " " | (N) -> move four lines up " | (N) -> move four lines down " | (N) -> move one word right " | (N) -> move one word left " " | (V) -> move a block up one line " | (V) -> move a block down one line " | (N) -> move a line up one line " | (N) -> move a line down one line " " | (V) -> move a block up a half page " | (V) -> move a block down a half page " | (N) -> move a line up a half page " | (N) -> move a line down a half page " | (V) -> move a block up a half page " | (V) -> move a block down a half page " | (N) -> move a line up a half page " | (N) -> move a line down a half page " " >> | (N) -> next difference (vimdiff/signify) " << | (N) -> previous difference (vimdiff/signify) " " (selection) " | (N) -> select all text " | (V) -> select all text " " | (V) -> select all text above " | (V) -> select all text below " | (V) -> select all text to the right " | (V) -> select all text to the left up to the indent " " | (V) -> select four lines up " | (V) -> select four lines down " | (V) -> select one word right " | (V) -> select one word left " " (remap dangerous functions that skip undo) " | (I) -> undo-able equivalent " | (I) -> undo-able equivalent " " Filetype Specific Mappings: " (extradite) " | (A) -> close the dialog " | (A) -> close the dialog " | (A) -> same as down " l | (A) -> same as j " | (A) -> same as Up " h | (A) -> same as k " " (gundo) " | (A) -> same as normal + justify on the left " | (A) -> same as the left mouse " | (A) -> same as the left mouse " | (A) -> same as down " l | (A) -> same as j " | (A) -> same as Up " h | (A) -> same as k " " (help) " q | (A) -> close the dialog " ? | (A) -> close the dialog " ?> | (A) -> close the dialog " ?< | (A) -> close the dialog " " (qf sidebar mappings) " | (A) -> left click + left justify the cursor " | (A) -> same as the left click " | (A) -> same as the left click " | (A) -> select entry " | (A) -> select entry but remain in qf sidebar " | (A) -> up " | (A) -> down " h | (A) -> j " l | (A) -> k " " (vimdiff) " <> | (N) -> update differences " ,. | (N) -> update differences " >< | (N) -> update differences " ., | (N) -> update differences " > | (N) -> replace diff in other pane with current pane " . | (N) -> replace diff in other pane with current pane " replace diff in current pane with other pane " replace diff in current pane with other pane " " (vimfiler) " | (A) -> left click + left justify the cursor " | (A) -> same as the left click " | (A) -> same as the left click " | (A) -> edit selected file " | (A) -> map to l, which opens a directory " | (A) -> map to h, which goes up one directory " ' | (A) -> edit the selected file " n | (A) -> start editing a new file " "DISABLED DEFAULT MAPPING: UNSET SHORTCUTS {{{ "-unmapping tabbing from < and > for use with diff "+these commands are replaced by tab and shift+tab noremap > noremap < "-unmapping help from F1 and Ctrl-F1 for use toggling the reference manual "+the :h topic feature works, and ? displays quickref map map map "-unmap the suspend function map "-unmap ex mode nnoremap Q "}}} "ALIASES: COMMAND SHORTCUTS {{{ "shortcuts to git commands cabbrev GitLog ':Extradite:wincmd x:wincmd j:resize 10' cabbrev gitlog ':Extradite:wincmd x:wincmd j:resize 10' cabbrev GitDiff ':Gdiff' cabbrev gitdiff ':Gdiff' cabbrev GitStatus ':Gstatus' cabbrev gitstatus ':Gstatus' cabbrev GitCommit ':Gcommit' cabbrev gitcommit ':Gcommit' "create various sizes of splits cabbrev vs33 ':VS33' cabbrev vs66 ':VS66' cabbrev sp33 ':SP33' cabbrev sp66 ':SP66' cabbrev diff vertical diffsplit "read/write file with sudo cabbrev sudow SudoWrite cabbrev wsudo SudoWrite cabbrev ws SudoWrite cabbrev sudoe SudoRead cabbrev esudo SudoRead cabbrev es SudoRead "add/remove character as keyword cabbrev ik setlocal iskeyword+= cabbrev iK setlocal iskeyword-= "}}} "MAPPINGS: GENERAL KEYBINDINGS AND REBINDINGS {{{ "MOUSE:{ "hold ctrl to scroll left/right instead of up/down noremap 4zl nnoremap 4zl xnoremap 4zl snoremap 4zl vnoremap 4zl inoremap 4zl noremap 4zl nnoremap 4zl xnoremap 4zl snoremap 4zl vnoremap 4zl inoremap 4zl noremap 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh noremap 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh "middle & ctrl+left = select from cursor nnoremap xnoremap snoremap vnoremap inoremap nnoremap xnoremap snoremap vnoremap inoremap "alt+left = line nnoremap V xnoremap $ snoremap $ vnoremap $ inoremap V "ctrl+alt+left = select paragraph nnoremap vip xnoremap ip$ snoremap ip$ vnoremap ip$ inoremap vip "ctrl+(middle/right) = copy nnoremap Vy xnoremap y snoremap y vnoremap y inoremap y nnoremap Vy xnoremap y snoremap y vnoremap y inoremap y "alt+(middle/right) = cut nnoremap x xnoremap x snoremap x vnoremap x inoremap x nnoremap x xnoremap x snoremap x vnoremap x inoremap x "ctrl+alt+(middle/right) = paste nnoremap p xnoremap p snoremap p vnoremap p inoremap p nnoremap p xnoremap p snoremap p vnoremap p inoremap p "configure middle click to paste from X noremap noremap! "} "TABS:{ nnoremap ':tabnext' nnoremap ':tabprev' nnoremap ':tabnew' nnoremap ':VimFiler -tab -project' nnoremap ':VimFiler -tab -project -double' "} "SPLIT:{ nmap { ':wincmd R' nmap } ':wincmd r' nmap ] ':vs' nmap 0 ':VS33' nmap ) ':VS66' nmap [ ':sp:wincmd j' nmap 9 ':SP33' nmap ( ':SP66' "} "DISPLAY:{ "clear search and reset buffer nnoremap ':noh:redraw!' nnoremap // ':noh:redraw!' "keep the currently highlighted term in a search vertically centered nnoremap n nzz nnoremap N Nzz nnoremap * *zz nnoremap # #zz "} "TOGGLES AND FEATURES:{ "add/remove cursor character as a keyword nmap k ':execute "setlocal iskeyword+=".getline(".")[col(".")-1]:echo "The character ".getline(".")[col(".")-1]." has been added to iskeyword"' nmap K ':execute "setlocal iskeyword-=".getline(".")[col(".")-1]:echo "The character ".getline(".")[col(".")-1]." has been removed from iskeyword"' "toggle the command reference box nnoremap ~ ':TCommand' "display tag information in the gutter noremap , ':TTagechoWord' "toggle the vim reference manual nnoremap ? ':h index.txt' "toggle the display of the left gutter nnoremap ` ':if (&number)set nonumberif (&foldenable)set nofoldenableendifif exists("b:sy")if (b:sy.active)SignifyToggleendifendifelseset numberif !(&foldenable)set foldenableendifif exists("b:sy")if !(b:sy.active)SignifyToggleendifendifendif:echo "gutter visibility toggled"' "toggle folded code at foldpoints nnoremap za "open all folds nnoremap = 'zn:echo "all folds have been opened"' nnoremap + 'zn:echo "all folds have been opened"' "close folds set to be closed nnoremap - 'zN:echo "all opened folds have been closed"' nnoremap _ 'zN:echo "all opened folds have been closed"' "reset all folds to the default fold level nnoremap 0 'zX:echo "all folds have been reset"' "view commit history and diffs nnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' xnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' inoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' nnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' xnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' inoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' nnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' xnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' inoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' nnoremap } ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' "bindings to trigger the tagbar list of tags nnoremap ':TagbarToggle:echo "tagbar toggled"' xnoremap ':TagbarTogglegv' inoremap ':TagbarToggle' nnoremap ':TagbarToggle:echo "tagbar toggled"' xnoremap ':TagbarTogglegv' inoremap ':TagbarToggle' nnoremap ':TagbarToggle:echo "tagbar toggled"' xnoremap ':TagbarTogglegv' inoremap ':TagbarToggle' nnoremap { ':TagbarToggle:echo "tagbar toggled"' "bindings to trigger the gundo undo history nnoremap ':GundoToggle:echo "undo history sidebar toggled"' xnoremap ':GundoToggle' inoremap ':GundoToggle' nnoremap ':GundoToggle:echo "undo history sidebar toggled"' xnoremap ':GundoToggle' inoremap ':GundoToggle' nnoremap ':GundoToggle:echo "undo history sidebar toggled"' xnoremap ':GundoToggle' inoremap ':GundoToggle' nnoremap ] ':GundoToggle:echo "undo history sidebar toggled"' "trigger vimfiler nnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' xnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' inoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' nnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' xnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' inoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' nnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' xnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' inoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' nnoremap [ ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' "toggle line wrapping (and bottom bar if using the gui) nnoremap ':set wrap!:echo "line wrapping toggled"' xnoremap ':set wrap!gv' inoremap ':set wrap!' nnoremap ':set wrap!:echo "line wrapping toggled"' xnoremap ':set wrap!gv' inoremap ':set wrap!' nnoremap ':set wrap!:echo "line wrapping toggled"' xnoremap ':set wrap!gv' inoremap ':set wrap!' "toggle show spelling errors nnoremap ':set spell!:if &spell =~ "0"echo "spellcheck toggled off"elseecho "spellcheck toggled on"endif' xnoremap ':set spell!gv' inoremap ':set spell!' nnoremap ':set spell!:if &spell =~ "0"echo "spellcheck toggled off"elseecho "spellcheck toggled on"endif' xnoremap ':set spell!gv' inoremap ':set spell!' nnoremap ':set spell!:if &spell =~ "0"echo "spellcheck toggled off"elseecho "spellcheck toggled on"endif' xnoremap ':set spell!gv' inoremap ':set spell!' "toggle external-paste mode set pastetoggle= "toggle syntax checking nnoremap ':SyntasticToggleAll' xnoremap ':SyntasticToggleAllgv' inoremap ':SyntasticToggleAll' nnoremap ':SyntasticToggleAll' xnoremap ':SyntasticToggleAllgv' inoremap ':SyntasticToggleAll' nnoremap ':SyntasticToggleAll' xnoremap ':SyntasticToggleAllgv' inoremap ':SyntasticToggleAll' "toggle goyo nnoremap ` ':Goyo' "} "GVIM TOGGLES:{ "toggle the menu nnoremap ":if &go=~#'m'set go-=melseset go+=mendif:echo 'Menu bar toggled'" vnoremap ":if &go=~#'m'set go-=melseset go+=mendifgv" inoremap ":if &go=~#'m'set go-=melseset go+=mendif" "toggle the toolbar nnoremap ":if &go=~#'T'set go-=Telseset go+=Tendif:echo 'Toolbar toggled'" vnoremap ":if &go=~#'T'set go-=Telseset go+=Tendifgv" inoremap ":if &go=~#'T'set go-=Telseset go+=Tendif" "toggle the scrollbars nnoremap ":if &go=~#'l'set go-=lRbelseset go+=lRbendif:echo 'Scrollbars toggled'" vnoremap ":if &go=~#'l'set go-=lRbelseset go+=lRbendifgv" inoremap ":if &go=~#'l'set go-=lRbelseset go+=lRbendif" "} "SPELLCHECK:{ "add the selected mispelled word to the local dictionary nnoremap ?+ zg "display a list of suggestions for the selected mispelled word nnoremap ?? hei "go to the next mispelled word nnoremap ?N ]s "go to the previous mispelled word nnoremap ?P [s "} "COPY PASTE AND UNDO REDO:{ "display contents of paste buffers nnoremap p ':reg' "P pastes and replaces the buffer, p pastes and keeps it vnoremap P p xmap p ReplaceWithRegisterVisual "copy the current character in normal mode nnoremap y vy "copy to the end of the line nnoremap T vg_y vnoremap T g_y "Alternatives to cut/deletion commands that don't replace the buffer nnoremap x "_x vnoremap x "_x nnoremap X "_X vnoremap X "_X nnoremap D "_D vnoremap D "_D nnoremap dd "_dd nnoremap dw "_dw vnoremap d "_d "map copy/paste shortcuts to more typical ones nnoremap P xmap ReplaceWithRegisterVisual inoremap p nnoremap vy vnoremap y nnoremap x vnoremap x inoremap db inoremap d0 inoremap " "remap ctrl-u and ctrl-w to safer alternatives inoremap u inoremap u "} "AUTOCOMPLETION:{ "emmet switch triggerkey from ctrl-y let g:user_emmet_leader_key='' "neocomplcache close popup and save indent inoremap =neocompl_cr() function! s:neocompl_cr() return pumvisible() ? neocomplcache#close_popup() : "\" endfunction "neocomplcache tab completion inoremap pumvisible() ? "\" : "\" "neocomplcache : undo completion inoremap neocomplcache#smart_close_popup()."\" "neocomplcache undo completion inoremap neocomplcache#undo_completion() "} "FORMATTING:{ "have backspace delete the selected text vnoremap "_x "format width to text width (or 80 chars if text width is 0) nnoremap J ':let b:tw=&textwidth:if (b:tw == 0)set tw=80endifgg0vG$gq:if (b:tw == 0)set tw=0let b:tw=80endif:echo "Document has been formatted to a width of ".b:tw." characters"' vnoremap J ':let b:tw=&textwidth:if (b:tw == 0)set tw=80endifgvgq:if (b:tw == 0)set tw=0let b:tw=80endif:echo "Selection has been formatted to a width of ".b:tw." characters"' "format by Vim syntax + by Autoformat tool syntax nnoremap f mzgg=G`z:echo "The document has been formatted" vnoremap f mz=`z:echo "The selection has been formatted" nnoremap F ':Autoformat:echo "The document has been formatted with :Autoformat"' "convert tabs to spaces and spaces to tabs nnoremap t ':let b:et=&expandtab:set expandtab:retab!:let &expandtab=b:et:echo "Tabs have been converted to spaces"' nnoremap T ':let b:et=&expandtab:set noexpandtab:%retab!:let &expandtab=b:et:echo "Spaces have been converted to tabs"' "remove trailing whitespace nnoremap w ':FixWhitespace:echo "Trailing whitespace has been removed"' "commant/uncomment current line/selection using tcomment nmap c gcc vmap c gc "align comments nnoremap A :exe "%Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*':redraw! vnoremap A :exe "'<,'>Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*':redraw! "align only comments following non-comments nnoremap a :exe "%Tabular" '/^ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*':redraw! vnoremap a :exe "'<,'>Tabular" '/^ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*':redraw! "tab/> and untab/< the currently selected lines vnoremap >gv nnoremap v>gv vnoremap > >gv nnoremap > v>gv vnoremap v vnoremap < < v "} "MOVEMENT:{ "additional mappings for easier access nnoremap = + nnoremap _ - "remap keys for speedier movement nnoremap 4k nnoremap 4j nnoremap nnoremap "remap keys to scroll to the end in a direction nnoremap gg0 nnoremap G$ nnoremap $ nnoremap ^ "remap alt+up/down to move blocks up/down a line vmap MoveBlockUp vmap MoveBlockDown nmap MoveLineUp nmap MoveLineDown "remap alt+left/right/h/l to move blocks up/down a half page vmap MoveBlockHalfPageUp vmap MoveBlockHalfPageDown nmap MoveLineHalfPageUp nmap MoveLineHalfPageDown vmap MoveBlockHalfPageUp vmap MoveBlockHalfPageDown nmap MoveLineHalfPageUp nmap MoveLineHalfPageDown "map signify to ]c and [c let g:signify_mapping_next_hunk = ']c' let g:signify_mapping_prev_hunk = '[c' "move to next/previous difference (vimdiff/signify) nmap >> ]c nmap << [c "} "SELECTION:{ "ctrl-a to select all nnoremap gg0vG$ xnoremap gg0vG$ "map remap keys for speedier text selection xnoremap 4k xnoremap 4j xnoremap xnoremap "remap keys to select all text in one direction xnoremap gg0 xnoremap G$ xnoremap $ xnoremap ^ "} "}}} "FILETYPE SPECIFIC MAPPINGS: {{{ "extradite autocmd FileType extradite map autocmd FileType extradite map l j autocmd FileType extradite map autocmd FileType extradite map h k autocmd FileType extradite map q autocmd FileType extradite map q autocmd FileType extradite map q autocmd FileType extradite map } q "gundo autocmd FileType gundo map 0l autocmd FileType gundo map autocmd FileType gundo map autocmd FileType gundo map autocmd FileType gundo map l j autocmd FileType gundo map autocmd FileType gundo map h k "help if !&diff autocmd FileType help map q ':q' autocmd FileType help map ':q' autocmd FileType help map ? ':q' endif "html "after running autoformat, remove linebreaks that aren't between tags autocmd FileType html,xhtml nnoremap F ':Autoformat:%s/\n\s*\([^<\ ]\)/ \1/g:echo "The document has been formatted with :Autoformat"' "markdown autocmd FileType mkd nnoremap F ':TableFormat' autocmd FileType mkd xnoremap F ':TableFormatgv' "qf-sidebar autocmd FileType qf map 0 autocmd FileType qf map autocmd FileType qf map autocmd FileType qf map <2-LeftMouse> autocmd FileType qf map p autocmd FileType qf map autocmd FileType qf map autocmd FileType qf map h j autocmd FileType qf map l k autocmd FileType qf map q ':call ToggleQuickfixList()' "vimdiff autocmd FilterWritePre * if &diff|nmap <> ':diffu'|endif autocmd FilterWritePre * if &diff|nmap ,. ':diffu'|endif autocmd FilterWritePre * if &diff|nmap >< ':diffu'|endif autocmd FilterWritePre * if &diff|nmap ., ':diffu'|endif autocmd FilterWritePre * if &diff|nmap > dp|endif autocmd FilterWritePre * if &diff|nmap . dp|endif autocmd FilterWritePre * if &diff|nmap < do|endif autocmd FilterWritePre * if &diff|nmap , do|endif autocmd FilterWritePre * if &diff|cabbrev q! qall!|endif "vimfiler autocmd FileType vimfiler map 0 autocmd FileType vimfiler map autocmd FileType vimfiler map autocmd FileType vimfiler map <2-LeftMouse> (vimfiler_edit_file) autocmd FileType vimfiler map l autocmd FileType vimfiler map h autocmd FileType vimfiler map ' e "}}} "MAPPINGS DISABLED FOR GIVEN FILETYPES: {{{ "remove incompatible toggles from specific file types autocmd Filetype extradite,gundo,help,tagbar,qf,vimfiler noremap ` autocmd Filetype gundo,help,tagbar,qf,vimfiler,diff noremap autocmd Filetype gundo,help,tagbar,qf,vimfiler,diff noremap autocmd Filetype gundo,help,tagbar,qf,vimfiler,diff noremap autocmd Filetype gundo,help,tagbar,qf,vimfiler,diff noremap } autocmd Filetype extradite,gundo,help,qf,vimfiler noremap autocmd Filetype extradite,gundo,help,qf,vimfiler noremap autocmd Filetype extradite,gundo,help,qf,vimfiler noremap autocmd Filetype extradite,gundo,help,qf,vimfiler noremap { autocmd Filetype extradite,help,tagbar,qf,vimfiler noremap autocmd Filetype extradite,help,tagbar,qf,vimfiler noremap autocmd Filetype extradite,help,tagbar,qf,vimfiler noremap ] autocmd Filetype extradite,help,tagbar,qf,vimfiler noremap autocmd Filetype extradite,gundo,help,tagbar,qf noremap autocmd Filetype extradite,gundo,help,tagbar,qf noremap autocmd Filetype extradite,gundo,help,tagbar,qf noremap autocmd Filetype extradite,gundo,help,tagbar,qf noremap [ "disable modifier keys with directions that would interfere with logic autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap autocmd Filetype qf,gundo,vimfiler,extradite noremap "}}}