THE SEMI-OFFICIAL IBM (c) DeveloperWorks (tm) VI CHEAT SHEET!

COMMAND (EX) MODE

MOVEMENT << Horizontal >>
->, l right-one character
<-, h left one character
0 beginning of line
$ end of line
w / W beginning of next word / bigword
e / E end of next word / bigword
b / B beginning of prev. word / bigword
( / ) beginning of prev. / next sentence
{ / } beginning of current / next paragraph

MOVEMENT ^^ Vertical vv
UpArrow, k up one line
DnArrow, j down one line
PgUp, ^B up one page
PgDn, ^P down one page
numberG goto line number
/string find string
n / N search next / search prev.
 
OPEN, SAVE + QUIT
:q quit
:q! quit without saving the changes
:w filename save as filename
:x save and quit
 
WINDOWING (Vim/Elvis)
:sp filename new split-frame window
^w^w goto next window
 
THESE COMMANDS MODIFY TEXT in ex mode
X delete character under cursor
J join next line to end of current line
rchar replace char under cursor char
dd delete current line
dmove delete from corpus to move
U undo
. repeat last edit command
 
INSERT MODE
Any of these commands ->
will put you in insert mode.
In insert mode, you can type in
text, hit return for a new line,
<-, v, ->, ^ to move and Delete.
To return to command mode, hit Esc.
 
i / a insert before / after corpus
I / A insert at beginning / end of line
o / O new line below / above, then insert
cc replace current line
cmove replace to move
 
COMPOUND COMMANDS - the power of Vi
MOTION!
3-> 3 chars right
4) 4 sentences ->
2b <- 2 words
12} -> 12 paragraphs
DELETION!
d3w delete next 3 words
d} delete remainder of p
d) delete rest of sentence.
CHANGE!
c) replace rest of sent.
c$ replace rest of line.
VISUAL MODE (vim/elvis)
  1. Press v to enter visual mode
  2. Move cursor to highlight text
  3. Press d to cut, y to copy
  4. Move to target location
  5. Hit p / P to paste before / after cursor
SEARCH / REPLACE in ex mode
:s/RegExp/Replace. 1st match current line
:s/RegExp/Replace./g all matches cur. line
:%s/RegExp/Replace./g global replace
:%s/RegExp/Replace./gc global with prompt