"=============================================================" " " " Darkcloud Neovim Config: keyboard settings " " " " By: Kevin MacMartin (prurigro@gmail.com) " " Website: https://github.com/prurigro/darkcloud-nvimconfig " " " " License: MIT " " " "=============================================================" " "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 " " :ik | (C) -> add following character to keywords " :iK | (C) -> remove following character from keywords " "Mappings: " (mouse) " | (A) -> scroll left " | (A) -> scroll left " | (A) -> scroll left " | (A) -> scroll right " | (A) -> scroll right " | (A) -> scroll right " " | (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 " " (terminal) " | (T) -> leave edit mode " " (tabs) " | (N) -> go to the next open tab " | (N) -> go to the previous open tab " | (N) -> open a new tab " " (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) " d | (N) -> VCS vimdiff in a new tab with signify " " ik | (N) -> add cursor character as a keyword " iK | (N) -> remove cursor character as a keyword " " ~ | (N) -> popup a command reference " | (N) -> toggle the vim reference manual " ? | (N) -> toggle the vim reference manual " ` | (A) -> toggle the gutter(numbers+folds+signify) " " | (N) -> toggle selected fold " " | (A) -> toggle line wrapping " | (A) -> toggle spell check " | (A) -> toggle external-paste mode " | (A) -> toggle syntax checking " " | (N) -> toggle git commit history " [ | (N) -> toggle git commit history " | (N) -> toggle the tagbar sidebar " ] | (N) -> toggle the tagbar sidebar " | (N) -> toggle the location list " " (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 to the end of the line " " (delete/cut operations that don't replace the paste buffer) " 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 " " (fixing-and-formatting) " 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) -> run available ale fixers on the document " t | (N) -> convert tabs into spaces " T | (N) -> convert spaces into tabs " w | (N) -> remove whitespace " | (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 " " (macros) " ' | (N) -> run a macro " " (movement) " = | (N) -> go to the first char on the next line " _ | (N) -> go to the first char on the previous line " " | (N) -> move four lines up " | (N) -> move four lines down " | (N) -> move one word right " | (N) -> move one word left " " | (A) -> move the screen up " | (A) -> move the screen down " | (A) -> move the screen to the right " | (A) -> move the screen to the left " " | (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 " " | (V) -> vim-move: move a block up one line " | (V) -> vim-move: move a block down one line " | (N) -> vim-move: move a line up one line " | (N) -> vim-move: move a line down one line " " ]g | (N) -> next difference (vimdiff/signify) " [g | (N) -> previous difference (vimdiff/signify) " >> | (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 " "Filetype Specific Mappings: " (help) " q | (A) -> close the dialog " ? | (A) -> close the dialog " ?> | (A) -> close the dialog " ?< | (A) -> close the dialog " " (error/location list) " | (A) -> up " | (A) -> down " l | (A) -> k " h | (A) -> j " | (A) -> select entry " | (A) -> select entry but remain in qf sidebar " q | (A) -> close the list " " (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 "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 "unmap shift+k opening help nnoremap "}}} "ALIASES: COMMAND SHORTCUTS {{{ "shortcuts to git commands 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 "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 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh noremap 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh noremap 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh 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 4zl nnoremap 4zl xnoremap 4zl snoremap 4zl vnoremap 4zl inoremap 4zl "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! "} "TERMINAL:{ tnoremap "} "TABS:{ nnoremap ':tabnext' nnoremap ':tabprev' nnoremap ':tabnew' "} "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:{ "VCS vimdiff in a new tab with signify nnoremap d ':SignifyDiff' "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' "toggle the vim reference manual nnoremap ? ':h index.txt' "toggle the display of the left gutter nnoremap ` ':if (&number)set nonumberif exists("b:sy")SignifyDisableendifelseset numberif exists("b:sy")SignifyEnableendifendif:echo "gutter visibility toggled"' "toggle folded code at foldpoints nnoremap za "toggle line wrapping (and bottom bar if using the gui) 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!' "toggle external-paste mode nnoremap ':if &pasteset paste!elseset pasteendif' "toggle syntax checking function! ToggleAle() ALEToggle if g:ale_enabled set scl=yes else set scl=auto endif endfunction nnoremap ':call ToggleAle()' xnoremap ':call ToggleAle()gv' inoremap ':call ToggleAle()' "view commit history and diffs nnoremap ':vs:0Gclog:wincmd b' nnoremap [ ':vs:0Gclog:wincmd b' "bindings to trigger the tagbar list of tags nnoremap ':TagbarToggle:echo "tagbar toggled"' nnoremap ] ':TagbarToggle:echo "tagbar toggled"' "toggle the location list nnoremap ':call ToggleLocationList()' "} "SPELLCHECK:{ "add the selected mispelled word to the local dictionary nnoremap ?+ zg "display a list of suggestions for the selected mispelled word nnoremap ?? heas "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 to the end of the line nnoremap Y vg_y "delete/cut operations that don't replace the paste 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 "} "FIXING AND FORMATTING:{ "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 nnoremap f mzgg=G`z:echo "The document has been formatted" vnoremap f mz=`z:echo "The selection has been formatted" "fix with ale nnoremap F ':ALEFix:echo "Available ale fixers have been run on the document"' "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"' "tab/> and untab/< the currently selected lines vnoremap >gv nnoremap v>gv vnoremap > >gv nnoremap > v>gv vnoremap v vnoremap < < v "} "MACROS:{ nnoremap ' @ "} "MOVEMENT:{ "additional mappings for easier access nnoremap = + nnoremap _ - "map ctrl+direction to shifting the screen in that direction nnoremap 4k nnoremap 4j nnoremap nnoremap noremap nnoremap xnoremap snoremap vnoremap inoremap noremap nnoremap xnoremap snoremap vnoremap inoremap noremap 4zl nnoremap 4zl xnoremap 4zl snoremap 4zl vnoremap 4zl inoremap 4zl noremap 4zh nnoremap 4zh xnoremap 4zh snoremap 4zh vnoremap 4zh inoremap 4zh "remap keys to scroll to the end in a direction nnoremap gg0 nnoremap G$ nnoremap $ nnoremap ^ "remap shift+ctrl+up/down to move blocks up/down a line with vim-move vmap MoveBlockUp vmap MoveBlockDown nmap MoveLineUp nmap MoveLineDown "move to next/previous difference (vimdiff/signify) nmap ]g (signify-next-hunk) nmap [g (signify-prev-hunk) nmap >> ]g nmap << [g "} "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: {{{ "help if !&diff autocmd FileType help map q ':q' autocmd FileType help map ':q' autocmd FileType help map ? ':q' endif "error/location list autocmd FileType qf map autocmd FileType qf map autocmd FileType qf map l j autocmd FileType qf map h k autocmd FileType qf map <2-LeftMouse> autocmd FileType qf map p autocmd FileType qf if getwininfo(win_getid())[0]['loclist'] == 0|map q ':call ToggleQuickfixList()'|else|map q ':call ToggleLocationList()'|endif "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 "}}} "MAPPINGS DISABLED FOR GIVEN FILETYPES: {{{ "remove incompatible toggles from specific file types autocmd Filetype help,tagbar,qf noremap ` autocmd Filetype help,tagbar,qf,diff noremap autocmd Filetype help,tagbar,qf,diff noremap autocmd Filetype help,tagbar,qf,diff noremap autocmd Filetype help,tagbar,qf,diff noremap } autocmd Filetype help,qf noremap autocmd Filetype help,qf noremap autocmd Filetype help,qf noremap autocmd Filetype help,qf noremap { autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap ] autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap autocmd Filetype help,tagbar,qf noremap [ "disable modifier keys with directions that would interfere with logic autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap autocmd Filetype qf noremap "}}}