"============================================================" " " " 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 " :wsudo & :sudow | (C) -> write the file as root using sudo " :esudo & :sudoe | (C) -> read a file as root using sudo " " Reference: (view plugin documentation for the full list of commands each offers) " (tcomment _ can also be -) " | (A) -> comment selection/create an empty comment " gc | (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 " + | (V) -> increase the selected region " _ | (V) -> decrease the selected region " | (N) -> center content and hide everything else " " (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 work) " 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 quickly " | (A) -> scroll left quickly " | (A) -> scroll right slowly " | (A) -> scroll left slowly " " | (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 the cursor " | (A) -> copy selection or character under the cursor " " | (A) -> cut selection or character under the cursor " | (A) -> cut selection or character under the 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 " " (toggles and features) " | (N) -> toggle the vim reference manual " ` | (A) -> toggle the gutter(line numbers, folds and signify) " " Space | (N) -> toggle selected fold " + | (N) -> open all folds " - | (N) -> unopen all folds " 0 | (N) -> reset all folds using default fold level " " | (A) -> toggle vimfiler sidebar " | (A) -> toggle the gundo sidebar " | (A) -> toggle the tagbar sidebar " | (A) -> toggle extradite git commit history " " | (A) -> toggle line wrapping " | (A) -> toggle spell check " | (A) -> toggle syntax checking " | (A) -> toggle external-paste mode " | (A) -> toggle line wrapping " | (A) -> toggle spell check " | (A) -> toggle syntax checking " | (A) -> toggle external-paste mode " " (gvim toggles) " | (A) -> toggle the menubar " | (A) -> toggle the toolbar " " (spellcheck) " ? | (N) -> toggle spellcheck error list " ?+ | (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 " " (completion) " , | (A) -> enter after emmet 'word' (ie: html:5) " | (I) -> (neocomp) autocomplete using common string " | (I) -> (neocomp) autocomplete the common string " | (I) -> (neocomp) close the suggestion popup " | (I) -> (neocomp) undo the most recent completion " " (search) " \ | (N) -> remove search highlighting " " (formatting) " | (V) -> deletes currently selected text " J | (N) -> format document text to 79 chars " J | (V) -> format selected text to 79 chars " f | (N) -> format document and return to cursor " f | (V) -> format the selection and return to cursor " F | (N) -> format document using :Autoformat " w | (N) -> remove whitespace " t | (N) -> convert tabs into spaces " | (V) -> indent all the lines currently selected " | (N) -> indent the current line " | (V) -> unindent all the lines currently selected " | (N) -> unindent the current line " " (movement) " = | (N) -> move to the first character on the next 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 a few lines up " | (N) -> move a few lines down " " | (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 " a | (N) -> select all text " | (V) -> select all text " a | (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 a few lines up " | (V) -> select a few lines down " | (V) -> select a few lines right " | (V) -> select a few lines left " " (copy/paste and undo/redo) " p | (N) -> view the paste buffers and register contents " y | (N) -> copies the character at the cursor " P | (V) -> save selection to the buffer and paste over " p | (V) -> preserve the buffer pasting over selected text " Direction | (N) -> paste in the direction entered " " (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 chars under and after the cursor on the line " D | (V) -> delete the currently selected lines " dw | (N) -> delete chars under and after the cursor in the word " dd | (N) -> delete lines under and after the one below " d | (V) -> delete the currently 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 " " (remap dangerous functions that skip undo) " | (I) -> undo-able equivalent " | (I) -> undo-able equivalent " " Filetype Specific Mappings: " (breeze->html compat) " _ | (N) -> move to the next sibling tag " + | (N) -> move to the previous sibling tag " - | (N) -> move to the first sibling tag " = | (N) -> move to the last sibling tag " _ | (N) -> move to the first child tag " + | (N) -> move to the last child tag " | (N) -> move to the parent tag " " (extradite) " | (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 " " (markdown) " | (A) -> show heading TOC instead of the taglist " " (markdown toc) " | (A) -> left click + left justify the cursor " | (A) -> same as the left click " | (A) -> same as the left click " | (A) -> select heading to edit " | (A) -> select heading but remain in toc " | (A) -> up " | (A) -> down " h | (A) -> j " l | (A) -> k " " (vimdiff) " <> | (N) -> update differences " >< | (N) -> update differences " > | (N) -> replace diff in other pane with current 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 "}}} "ALIASES: COMMAND SHORTCUTS {{{ 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' cabbrev sudow SudoWrite cabbrev wsudo SudoWrite cabbrev sudoe SudoRead cabbrev esudo SudoRead "}}} "MAPPINGS: GENERAL KEYBINDINGS AND REBINDINGS {{{ "MOUSE:{ "hold ctrl to scroll left/right instead of up/down nnoremap 4zl xnoremap 4zl inoremap 4zl nnoremap 4zh xnoremap 4zh inoremap 4zh "hold alt to scroll left/right more precisely nnoremap zl xnoremap zl inoremap zl nnoremap zh xnoremap zh inoremap zh "middle & ctrl+left = select from cursor nnoremap xnoremap inoremap nnoremap xnoremap inoremap "alt+left = line nnoremap V xnoremap $ inoremap V "ctrl+alt+left = select paragraph nnoremap vip xnoremap ip$ inoremap vip "ctrl+(middle/right) = copy nnoremap Vy vnoremap y inoremap y nnoremap Vy vnoremap y inoremap y "alt+(middle/right) = cut nnoremap x xnoremap x inoremap x nnoremap x xnoremap x inoremap x "ctrl+alt+(middle/right) = paste nnoremap p xnoremap p inoremap p nnoremap p xnoremap 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' "} "TOGGLES AND FEATURES:{ "toggle the vim reference manual nnoremap ':h index.txt' "toggle the display of the left gutter nnoremap ` ':if (&number)set number!if (&foldenable)set foldenable!endifif exists("b:sy")if (b:sy.active)SignifyToggleendifendifelseset number!if !(&foldenable)set foldenable!endifif 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"' xnoremap + 'zngv' inoremap + 'zn' "close folds set to be closed nnoremap - 'zN:echo "all opened folds have been closed"' xnoremap - 'zNgv' inoremap - 'zN' "reset all folds to the default fold level nnoremap 0 'zX:echo "all folds have been reset"' xnoremap 0 'zXgv' inoremap 0 'zX' "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' "bindings to trigger the gundo undo history nnoremap ':GundoToggle:echo "undo history sidebar toggled"' xnoremap ':GundoToggle' inoremap ':GundoToggle' "bindings to trigger the tagbar list of tags nnoremap ':TagbarToggle:echo "tagbar toggled"' xnoremap ':TagbarTogglegv' inoremap ':TagbarToggle' "view commit history and diffs nnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' xnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' inoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' "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!' "toggle spellcheck nnoremap ':set spell!:echo "spell checking toggled"' xnoremap ':set spell!gv' inoremap ':set spell!' nnoremap ':set spell!:echo "spell checking toggled"' xnoremap ':set spell!gv' inoremap ':set spell!' "toggle syntax checking nnoremap ':SyntasticToggleMode' xnoremap ':SyntasticToggleModegv' inoremap ':SyntasticToggleMode' nnoremap ':SyntasticToggleMode' xnoremap ':SyntasticToggleModegv' inoremap ':SyntasticToggleMode' "toggle external-paste mode set pastetoggle= noremap "} "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" "} "SPELLCHECK:{ "trigger spellcheck bar nnoremap ? ':UpdateAndSpellCheck:call ToggleQuickfixList():wincmd j' "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 "} "COMPLETION:{ "emmet switch triggerkey from let g:user_emmet_leader_key='' "neocomplcache: scroll through completion list inoremap pumvisible() ? "\" : "\" "neocomplcache: complete the common part of the string inoremap neocomplcache#complete_common_string() "neocomplcache: close popup and delete backward char inoremap pumvisible() ? neocomplcache#smart_close_popup() : "\" "neocomplcache : undo completion inoremap "" . neocomplcache#undo_completion() "} "FORMATTING:{ nnoremap / ':noh:echo "Search results have been cleared"' "} "FORMATTING:{ "have backspace delete the selected text vnoremap "_x "formatting options to apply to the whole document nnoremap J ':set tw=79gggqG:set tw=0:echo "Document text has been formatted to a width of 79 characters"' vnoremap J ':set tw=79gvgq:set tw=0:echo "Selected text has been formatted to a width of 79 characters"' 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" nnoremap w ':FixWhitespace:echo "Trailing whitespace has been removed"' nnoremap t ':retab:noh:echo "Tabs have been converted to spaces"' "tab and untab the currently selected lines vnoremap >gv nnoremap v>gv vnoremap v "} "MOVEMENT:{ "additional mappings for easier access nnoremap = + "remap keys for speedier movement nnoremap 4k nnoremap 4j "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 (and an alt for screen users) nnoremap gg0vG$ xnoremap gg0vG$ nnoremap a gg0vG$ xnoremap a gg0vG$ "map remap keys for speedier text selection xnoremap 4k xnoremap 4j xnoremap 6l xnoremap 6h "remap keys to select all text in one direction xnoremap gg0 xnoremap G$ xnoremap $ xnoremap ^ "} "COPY PASTE AND UNDO REDO:{ "display contents of paste buffers nnoremap p ':reg' "allow y to copy a single character in normal mode nnoremap y vy "P pastes and replaces the buffer, p pastes and keeps it vnoremap P p xmap p ReplaceWithRegisterVisual "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 hello and good day nnoremap dw "_dw vnoremap d "_d "map copy/paste shortcuts to more typical ones nnoremap P xmap ReplaceWithRegisterVisual inoremap p nnoremap y vnoremap y nnoremap x vnoremap x "remap ctrl-u and ctrl-w to safer alternatives inoremap u inoremap u "} "}}} "FILETYPE SPECIFIC MAPPINGS: {{{ "breeze compatible formats autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap _ ':BreezePrevSibling' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap + ':BreezeNextSibling' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap - ':BreezeFirstSibling' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap = ':BreezeLastSibling' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap _ ':BreezeFirstChild' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap + ':BreezeLastChild' autocmd BufNewFile,BufRead *.html,*.htm,*.xhtml,*.xml,*.php,*.aspx nmap ':BreezeParent' "extradite autocmd FileType extradite map autocmd FileType extradite map l j autocmd FileType extradite map autocmd FileType extradite map h k autocmd FileType diff,extradite map ':Extradite' "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' endif "markdown: launch table of contents instead of the tagbar autocmd FileType mkd map ':Toch' "markdown table of contents 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 ':hide' autocmd FileType qf map ? ':hide' "vimdiff autocmd FilterWritePre * if &diff|nnoremap <> ':diffu'|endif autocmd FilterWritePre * if &diff|nnoremap >< ':diffu'|endif autocmd FilterWritePre * if &diff|nnoremap > dp|endif autocmd FilterWritePre * if &diff|nnoremap < 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 autocmd FileType vimfiler map ~ q "}}} "DISABLED MAPPINGS FOR FILETYPES: {{{ "remove incompatible toggles from specific file types autocmd Filetype qf,vimfiler,extradite,help noremap autocmd Filetype qf,ggundo,vimfiler,extradite,help noremap autocmd Filetype ggundo,vimfiler,extradite,tagbar,help noremap ? autocmd Filetype qf,ggundo,vimfiler,tagbar,help noremap <12> "disable modifier keys with directions that would interfere with logic autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap autocmd Filetype qf,ggundo,vimfiler,extradite noremap "}}}