vi Command Summary

Here are all the things you can do in vi

All commands are command mode only unless otherwise noted.

.
repeat last command (insert, change, or delete)
^@
repeat last command
@buffer
execute command stored in buffer
a
append text after cusor
A
append text at end of line
^A
unused
b
back up to beginning of word
B
back up to beginning of work, ignoring punctuation
^B
scroll back one window's worth
c
change text
C
change to end of line
^C
unused
d
delete text
D
delete to end of line
^D
(command mode) scroll down half-window (insert mode) back up one tab stop
e
move to end of word
E
move to end of word, ignoring punctuation
^E
scroll down one line
f
find next character forward on current line
F
find previous character backward on current line
^F
scroll forward one window
g
unused
G
go to specific line or end of file
^G
unused
h
cursor left
H
go to top line of screen
^H
(command mode) cursor left (inser mode) backspace
i
insert text before cursor
I
insert text at beginning of line
^I
(insert mode) tab
j
cursor down
J
join lines
^J
cursor down
k
cursor up
K
unused
^K
unused
l
cursor right
L
go to bottom line of screen
^L
redraw screen
m
mark current position in register
M
go to middle line of screen
^M
carriage return
n
repeat last search command
N
repeat last search command in opposite direction
^N
cursor down
o
open line below current line
O
open line above current line
^O
unused
p
put yanked or deleted text after or below cursor
P
put yanked or deleted text before or above cursor
^P
cursor up
q
unused
Q
switch to ex
^Q
(insert mode)escape next character
r
replace character
R
replace characters
^R
redraw screen
s
change current character and leave in input mode
S
change entire line
^S
unused
t
move cursor forward to character before next character typed
T
move cursor backward to character after next character typed
^T
(insert mode) tab
u
undo
U
undo line
^U
scroll screen up half window
v
unused
V
unused
^V
(insert mode) escape next character
w
move to beginning of next word
W
move to beginning of next word, ignoring punctuation
^W
(insert mode) back up to beginning of word
x
delete character under cursor
X
delete character before cursor
^X
unused
y
yank (copy) text
Y
yank entire line
^Y
scroll up one line
z
redraw screen positioning cursor when followed by CR at the top, . at middle, and - at the bottom of the screen
ZZ
save and exit
^Z
unused

vi evangelical series / corby@intuit.com
January 1995 (updated April 6, 1998)