
Vi Editor Cheat Sheet
Movement Commands
Character
h, j, k, lLeft, down, up, right
Text
w, W, b, BForward, backward by word
e, E End of word
(, )Beginning of next, previous sentence
{, }Beginning of next, previous paragraph
[[, ]] Beginning of next, previous section
Lines
0, $First, last position of current line
^First non-blank character of current line
+, -First character of next, previous line
HTop line of screen
MMiddle line of screen
LLast line of screen
nH, nLLine n from top, bottom of screen
Scrolling
[Ctrl]F, [Ctrl]B Scroll forward, backward one screen
[Ctrl]D, [Ctrl]U Scroll down, up one-half screen
[Ctrl]E, [Ctrl]Y Show one more line at bottom, top of window
z[Enter] Scroll until line with cursor is at top of screen
z. Scroll until line with cursor is at middle of screen
z- Scroll until line with cursor is at bottom of screen
Searches
/pattern Search forward for pattern
?pattern Search backward for pattern
n, NRepeat last search in same, opposite direction
/, ?Repeat previous search forward, backward
fxsearch forward for character x in current line
Fxsearch backward for character x in current line
txsearch forward for character before x in current line
Txsearch backward for character after x in current line
;Repeat previous current-line search
,Repeat previous current-line search in opposite direction
Line Number
[Ctrl]GDisplay current line number
nGMove to line number n
GMove to last line in file
:nmove to line number n
Marking Position
mxMark current position as x
`xMove cursor to x
`` Return to previous mark or context
'xMove to beginning of line containing mark x
'' Return to beggining of line containing previous mark
Editing Commands
Insert
i, aInsert text before, after cursor
I, AInsert text at beginning, end of line
o, OOpen new line for text below, above cursor
Change
rReplace with next typed characer