diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 46d0551..0333238 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -14,6 +14,9 @@ " " 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 " @@ -156,23 +159,36 @@ " | (V) -> select a few lines right " | (V) -> select a few lines left " -" (paste functions) +" (copy/paste and undo/redo) " p | (N) -> view the paste buffers and register contents -" p | (N) -> paste in the direction entered " 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) -" d | (V) -> delete the currently selected text -" x | (V) -> delete the currently selected text -" x | (N) -> delete the char(s) under and the cursor -" X | (V) -> delete the currently selected lines -" X | (N) -> delete the char(s) before the cursor -" D | (V) -> delete the currently selected lines -" D | (N) -> delete chars under and after the cursor on the line -" dw | (N) -> delete chars under and after the cursor in the word -" dd | (N) -> delete lines under and after the one below +" (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 +" +" (typical 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) @@ -240,6 +256,13 @@ "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 @@ -339,43 +362,43 @@ "unmap F1 from help then map it to toggle the display of line numbers nnoremap ':set number!:echo "line numbers toggled"' - xnoremap ':set number!v' + xnoremap ':set number!gv' inoremap ':set number!' "toggle the cursor line and column nnoremap ':set cursorline! cursorcolumn!:echo "cursor crosshair toggled"' - xnoremap ':set cursorline! cursorcolumn!v' + xnoremap ':set cursorline! cursorcolumn!gv' inoremap ':set cursorline! cursorcolumn!' "toggle line wrapping (and bottom bar if using the gui) nnoremap ':echo "line wrapping toggled":set wrap!' - xnoremap ':set wrap!v' + xnoremap ':set wrap!gv' inoremap ':set wrap!' "toggle all folds nnoremap zi:echo "code folding toggled" - xnoremap ziv + xnoremap zigv inoremap zi "toggle spellcheck nnoremap ':set spell!:echo "spell checking toggled"' - xnoremap ':set spell!v' + xnoremap ':set spell!gv' inoremap ':set spell!' "toggle syntax checking nnoremap ':SyntasticToggleMode' - xnoremap ':SyntasticToggleModev' + xnoremap ':SyntasticToggleModegv' inoremap ':SyntasticToggleMode' "toggle signify and signify highlight let g:signify_mapping_toggle = '' nnoremap ':Extradite:wincmd x:wincmd j:resize 10' - xnoremap ':Extradite:wincmd x:wincmd j:resize 10' + xnoremap ':Extradite:wincmd x:wincmd j:resize 10gv' inoremap ':Extradite:wincmd x:wincmd j:resize 10' "bindings to trigger the tagbar list of tags nnoremap ':TagbarToggle:echo "tagbar toggled"' - xnoremap ':TagbarTogglev' + xnoremap ':TagbarTogglegv' inoremap ':TagbarToggle' "bindings to trigger the tagbar list of errors @@ -395,15 +418,15 @@ "GVIM TOGGLES:{ "map toggles for the menu, toolbar and vertical scrollbar nnoremap ":if &go=~#'m'set go-=melseset go+=mendif:echo 'Menu bar toggled'" - vnoremap ":if &go=~#'m'set go-=melseset go+=mendifv" + vnoremap ":if &go=~#'m'set go-=melseset go+=mendifgv" inoremap ":if &go=~#'m'set go-=melseset go+=mendif" nnoremap ":if &go=~#'T'set go-=Telseset go+=Tendif:echo 'Toolbar toggled'" - vnoremap ":if &go=~#'T'set go-=Telseset go+=Tendifv" + vnoremap ":if &go=~#'T'set go-=Telseset go+=Tendifgv" inoremap ":if &go=~#'T'set go-=Telseset go+=Tendif" nnoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendif:echo 'Scrollbars toggled'" - vnoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendifv" + vnoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendifgv" inoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendif" "} @@ -504,28 +527,40 @@ xnoremap ^ "} - "PASTE:{ + "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 puts text it replaces in the buffer and p does not + "P pastes and replaces the buffer, p pastes and keeps it vnoremap P p xmap p ReplaceWithRegisterVisual - nmap ReplaceWithRegisterOperator - "Alternatives to deletion commands that don't replace the buffer - vnoremap x "_x + "Alternatives to cut/deletion commands that don't replace the buffer nnoremap x "_x - vnoremap X "_X + vnoremap x "_x nnoremap X "_X - vnoremap D "_D + vnoremap X "_X nnoremap D "_D - vnoremap d "_d - nnoremap dd "_dd + 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 "} "}}}