A List of VI Commands

Input mode: set insertion point

i- insert text at cursor
a- append text after cursor
I- insert text at beginning of line
A- append text at end of line
o- open line below cursor
O- open line above cursor

Deletion and Change: delete/change words or characters

dw- delete a single word
cw- change a word
dd- delete entire line
R- replace line
D- delete from cursor position to end of line
C- change from cursor position to end of line
x- delete a single character
r- replace a character

Cursor movement: position the cursor

l- move right
h- move left
j- move down
k- move up
$- move to end of line
^- move to beginning of line
w- move to next word
e- move to end of word
1G- move to first line
nG- move to line n (where n is a number)
G- move to last line

Screen movement: move a screen at a time

ctrl-d- scroll forward half a screen
ctrl-u- scroll back half a screen
ctrl-f- move to next screen
ctrl-b- move to previous screen
ctrl-l- redraw screen

Last line mode: used when ending an editing session

:w- write buffer
:q- quit
:q!- force quit without saving
:wq- write and quit (save)
:n- next file
:r- read file
:e- edit file
:f- file name
:set- set options on
:set no- set options off
:!- escape to shell
:n- go to line n

Miscellaneous

u- undo last action
/- search forward
?- search back
n- repeat search
.- repeat last command
yy- yank line
p- put below cursor
P- put above cursor
ZZ- write and quit

Back to Menu

Copyright 2002
Novospace.com