Useful "vi" Commands

Switching Modes

Command Mode
[Esc]			Enter Command Mode

Insert Mode
a			Append after cursor
A			Append at end of line
c			Begin change operation
C			Change to end of line
i			Insert before cursor.
o			Open below current line
O			Open above current Line
R			Begin overwrite

Delete
5x			Delete 5 charcaters
dd			Delete current line

Movement Commands

h, l or	Spacebar	Left, Right
b, B, w, W		Left, Right by word
j, k			Down, Up
[Ctrl]-F, [Ctrl]-B	Foward Screen, Back Screen
[Ctrl]-L		Redraw
0, $			Beginning, End of line
nH, nL			n lines after top line, before last line
nG, G			move to line n, move to last line in file

Copy / Paste

yy			Copy line
ye			Copy to end of word
p			Paste

Save/Quit Commands

ZZ			Quit and save if changes were made
:q!			Quit w/o saving
:w file			Write to file
:n1,n2w >> file		Append line n1 to n2 to existing file.

Command Line Options

vi options files	General syntax
-R			Read only mode
+			Position vi on last line of file
+n			Position vi on nth line of file
+/pat			Position vi on line containing pattern pat

Other

u			Undo
:1,$s/pattern-to-substitute/new-text
			Search and replace.  1 means start from line 1; $ means go to EOF