From: "Bruce Ascroft" <bascroft@symantec.com>
Allan,
I created the following list of common commands as a reference for vi:
hjkl Move cursor one line
up/down or one space right/left
0(zero) Move cursor to the beginning of
whatever line it is on
$ Move
cursor to the end of the line
42G Move cursor to line (or another specified
line)
G Move
cursor to the last line in your file
w Move
cursor forward to the first letter of the next word
e Move
cursor forward to the end of a word
b Move
cursor backward to the previous beginning of a word
-
Position cursor at the beginning of previous line
+
Position cursor at the beginning of next line
42I Position cursor at column of current line (or
another specified
number)
L
Position cursor at lowest line displayed on the screen
M
Position cursor at midpoint on the screen
H
Position cursor at the highest line on the screen
fb Move cursor forward on the line to next
(or to another specified
character)
Fb Move cursor backward on the line to
previous (or to another specified
character)
/word Move cursor forward through text to next instance of
word
?word Move cursor backward through text to prior instance of
word
n Move to the next instance of the pattern
identified in a previously
issued /word or ?word
'' (Two single quotes) Moves the cursor to
the previous location in the
file
CTRL-D Move the cursor down a block of
text in a file
CTRL-U Move the cursor up a block of
text in a file
CTRL-F Display the next screen of text
in a file
CTRL-B Display the previous screen of
text in a file
a
Insert text to the right of the cursor
A Append
text to the end of the line
i Insert
text to the left of the cursor
I Insert
text at the beginning of the line
o Open a
new line below the cursor
O Open a
new line above the cursor
cw Change the current word
s
Substitute for a single character
S
Substitute for an entire line.
cc Substitute for an entire line (same as
S)
C Change
the rest of the line (from the cursor position forward)
ESC Escape from insert mode and return to vi
command mode
:read file Read the contents of file into the current file
:#read file Read the contents of file into the current file,
below line #
dd Delete current line of text
#dd Delete # lines of text
dw Delete one word from text
#dw Delete # words from text
x Delete the current character
#X Delete # characters from text
r
Replace the one character under the cursor with the next
character typed
u Undo;
reverse last textchange action
U Undo; reverse all text-change action on the
line, if you have not moved
from the line since it was last modified
|
|
|