"=============================================================" " " " Darkcloud Neovim Config: keyboard settings " " " " By: Kevin MacMartin (prurigro@gmail.com) " " Website: https://github.com/prurigro/darkcloud-nvimconfig " " " " License: MIT " " " "=============================================================" " "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) " " (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) -> split vertically " [ | (N) -> split horizontally " " (rotate) " { | (N) -> rotate counter-clockwise " } | (N) -> rotate clockwise " " (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) -> toggle the gutter " ~ | (N) -> toggle folds " " | (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 vista sidebar " ] | (N) -> toggle the vista 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 " " (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) -> unindent all the lines currently selected " | (N) -> unindent the current line " [ | (N) -> insert a blank line above the current one " ] | (N) -> insert a blank line below the current one " " (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) " " [[ | (N) -> jump to previous issue in the location list (qf.nvim) " ]] | (N) -> jump to the next issue in the location list (qf.nvim) " " (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 " "File type Specific Mappings: " (help) " q | (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 " < | (N) -> replace diff in current pane with other pane " , | (N) -> 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, Alt-F1 and Ctrl-F1 map map map "-unmap the suspend function map "-unmap ex mode nnoremap Q "unmap shift+k opening help nnoremap "}}} "MAPPINGS: GENERAL KEYBINDINGS AND REBINDING {{{ "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 "} "TERMINAL:{ tnoremap "} "TABS:{ nnoremap ':tabnext' nnoremap ':tabprev' nnoremap ':tabnew' "} "SPLIT:{ nmap ] ':vs' nmap [ ':sp:wincmd j' "} "ROTATE:{ nmap { ':wincmd R' nmap } ':wincmd r' "} "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 gutter nnoremap ` ':if (&number)set nonumberif exists("b:sy")SignifyDisableendifelseset numberif exists("b:sy")SignifyEnableendifendif:echo "gutter visibility toggled"' "toggle the fold sidebar function! FoldToggle() if (&foldcolumn == 0) set foldenable set foldcolumn=1 normal zR else set nofoldenable set foldcolumn=0 endif endfunction nnoremap ~ ':call FoldToggle()' "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 vista list of tags nnoremap ':Vista!!' nnoremap ] ':Vista!!' "toggle the location list nnoremap lua require('qf').toggle('l', false) "} "SPELLCHECK:{ "add the selected misspelled word to the local dictionary nnoremap ?+ zg "display a list of suggestions for the selected misspelled word nnoremap ?? heas "go to the next misspelled word nnoremap ?N ]s "go to the previous misspelled 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 vnoremap p P "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"' "indent and unindent the currently selected lines vnoremap >gv nnoremap v>gv vnoremap v "insert blank lines above and below the current one nnoremap ] :call append(line("."), repeat([""], v:count1)) nnoremap [ :call append(line(".")-1, repeat([""], v:count1)) "} "MACROS:{ nnoremap ' @ "} "MOVEMENT:{ "additional mappings for easier access nnoremap = + nnoremap _ - "map ctrl+up/down to moving the cursor up and down by 4 lines nnoremap 4k nnoremap 4j "map ctrl+right/left to moving the cursor left and right by one word nnoremap nnoremap "map alt+direction to moving the viewport in that direction 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 "jump to the previous and next issues in the location list nnoremap [[ lua require('qf').above('l') nnoremap ]] lua require('qf').below('l') "} "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' 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 map q ':q' "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 FILE TYPES: {{{ "remove incompatible toggles from specific file types autocmd Filetype help,qf,diff,vista noremap autocmd Filetype help,qf,diff,vista noremap [ autocmd Filetype help,qf,diff noremap autocmd Filetype help,qf,diff 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 "}}}