Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
notes:vim_cheat_sheet [2008/06/05 01:38]
smthng
notes:vim_cheat_sheet [2010/04/06 16:33] (current)
smthng
Line 14: Line 14:
 In navigation mode, the following can be used to move around In navigation mode, the following can be used to move around
  
-  *  **\/ j k >** - Move by one letter -  : h-left, l-right, j-down, k-up+  *  **← ↓ j k ↑ ** - Move by one letter -  : h-left, l-right, j-down, k-up
   * **w b e** - Move by words -  w - next word, b - prev word, e - end of word   * **w b e** - Move by words -  w - next word, b - prev word, e - end of word
   * **W B E** Move by sequences of non-blanks (Words) -  W - next Word, B - prev Word, E - end of Word   * **W B E** Move by sequences of non-blanks (Words) -  W - next Word, B - prev Word, E - end of Word
   * **f F** - find character, Find character backwards   * **f F** - find character, Find character backwards
   * **t T** - stop before next/last instance of character   * **t T** - stop before next/last instance of character
 +  * **; ,** - repeat or reverse last t/T/f/F
  
   * **()** - goto start or end of sentence   * **()** - goto start or end of sentence
Line 24: Line 25:
   * **%** jump to matching brace   * **%** jump to matching brace
   * **gg/G** - goto start or end of buffer   * **gg/G** - goto start or end of buffer
-  * **0 $** - goto start or end of line+  * **0 $** - goto start, first non-blank, end of line
   * **nG** - goto line n   * **nG** - goto line n
-  * +/-** - goto next/previous line +  * **+/-** - goto next/previous line 
-  * **H M L** - gopto top / middle / bottom of screen+  * **H M L** - goto top / middle / bottom of screen
  
 ===== Basic Editing ===== ===== Basic Editing =====
Line 35: Line 36:
   * **R** - overwrite   * **R** - overwrite
   * **dd cc** - delete or change line (enter insert mode)   * **dd cc** - delete or change line (enter insert mode)
 +  * **D C** - delete or change to end of line
   * **d c [n] X** - delete or change where X is a navigation command eg d2w. Change enters insert mode.   * **d c [n] X** - delete or change where X is a navigation command eg d2w. Change enters insert mode.
   * **o O** - open new line for inserting below or above   * **o O** - open new line for inserting below or above
   * **x s** - delete character, delete character and start inserting   * **x s** - delete character, delete character and start inserting
 +  * **S** - delete line and start inserting
 +  * **r** - replace single character
 +  * **J** - join line with next one
  
 ===== Copying & Pasting ===== ===== Copying & Pasting =====
Line 44: Line 49:
   * **dd yy** - delete or yank line into buffer   * **dd yy** - delete or yank line into buffer
   * **p P** - paste after or before   * **p P** - paste after or before
 +  * **ctrl-R** - paste while in edit mode
   * **"[a-z]** - used before delete/yank/paste to specify a register   * **"[a-z]** - used before delete/yank/paste to specify a register
   * **"[A-Z]** - used before delete/yank to append to previous contents of register   * **"[A-Z]** - used before delete/yank to append to previous contents of register
   * **"* "+** - Use system clipboard as register   * **"* "+** - Use system clipboard as register
 +  * **v V ctrl-V** - enter select mode (character, line or block)
  
-===== Searching & Bookmarks=====+===== Searching & Bookmarks =====
  
   * **/ ?** - Start incremental search forwards or backwards   * **/ ?** - Start incremental search forwards or backwards
Line 56: Line 63:
   * **`[a-z]** - jump to bookmark   * **`[a-z]** - jump to bookmark
   * **'[a-z]** - jump to first non-blank on bookmarked line   * **'[a-z]** - jump to first non-blank on bookmarked line
-  * **[A-Z]]** - global bookmarks (not buffer-specific)+  * **[A-Z]** - global bookmarks (not buffer-specific)
   * **.** - bookmark of last modification   * **.** - bookmark of last modification
 +
 +===== Folding =====
 +
 +  * Folding allows temporarily hiding blocks of text. Folding commands start with z.
 +  * **zR zr** - opens all folds / one level of folds
 +  * **zM zm ** - closes all folds / one level of folds
 +  * **zO zo** - opens all folds at the cursor / one level of folds at the cursor
 +  * **zC zc** - closes all folds at the cursor / one level of folds at the cursor
 +  * **[z ]z** - jump to start/end of fold
 +  * **zj zk** - jump to previous / next fold
 +  * **zE zd** - delete all folds / fold at cursor
  
 ===== Assorted ===== ===== Assorted =====
Line 64: Line 82:
   * **@[a-z]** - play macro   * **@[a-z]** - play macro
   * **@@** - play last played macro   * **@@** - play last played macro
 +
 +  * **> <[n]X** - indent / unindent 
 +  * **i a** - after d/c/y/</> inner block or inner block including delimiters. e.g. di( deletes current bracketed block
 +  
 +
 +  * **u / U** - undo , undo change to entire line
 +  * **ctrl-r** - redo
 +  * **ZZ** - save and quit
 +  * **ZQ** - quit without saving
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki