<<Back to Help:vi
The following list describes the meaning of each character that's used
by the editor. Some characters have meaning in both command and
insert mode; these are all described.
Vi keys can be split into the following functional groups (as marked here):
movement operator other. Some keys result in entering insert mode.
Other lists like this on the net also exist:
Unassigned keys[edit]
The following keys have no assignment by default in vi.
In insert mode, your termal's stty setting might assign a function to some of
these control characters. All of these unassigned keys should be available for
alias (macro) assignment.
Unassigned keys: ^A ^C ^I ^K ^O ^Q ^R ^S ^W ^X # * = K V g q v
Control keys[edit]
^B |
Move backward one screen.
|
^D |
Scroll the window down one half screen.
|
^E |
Scroll the screen up one line.
|
^F |
Scroll forward one screen.
|
^G |
Same as ":f" command. Displays file information.
|
^H (BS) |
Moves cursor left one space in command mode. In insert mode, erases the last character typed.
|
^J |
Move the cursor down one line.
|
^L |
Clear and redraw the screen.
|
^M (CR) |
Move to the first non-white character in the next line. In insert mode, a carriage return opens a new line for input.
|
^N |
Move the cursor down a line.
|
^P |
Move the cursor up a line.
|
^T |
Tag stack
|
^U |
Scroll the window up one half screen.
|
^V |
In insert mode, next character is taken literally
|
^Y |
Scroll the screen down one line.
|
^Z |
Stop vi (see shell job control)
|
^[ |
Escape cancels a pending command in command mode, and terminates insert mode.
|
^] |
Moves to the tag whose name is given by the word in which the cursor resides.
|
SPACE |
Move the cursor right on column.
|
Punctuation and number keys[edit]
@x |
execute commands in register x
|
! |
Operate on text by running a command over it; text becomes input to the command; output from the command replaces the text.
|
"x |
next yank or delete is saved in register x
|
$ |
Move to the end of the current line.
|
% |
Move to the parenthesis, brace or bracket ( ) { } [ ] matching the one at or after the current position.
|
^ |
Move to the first non-white on the current line.
|
& |
repeat the last search and replace on the current line (:s)
|
( |
Move back to the start of a sentence.
|
) |
Move forward to the start of the next sentence.
|
- |
Move to the first non-white character in the previous line.
|
+ |
Move to the first non-white character in the next line.
|
~ |
toggle case of letter under cursor and move to next character
|
_ (underscore) |
Move to the start of the line, or the nth line if given a count
|
` (backtick) |
Move to the character position of the given mark (or last context if doubled)
|
' (tick) |
Move to the line containing the given mark (or last context if doubled)
|
, (comma) |
Move reverse of the last t, T, f, or F command.
|
. |
Repeat the last edit command.
|
/ |
Start of a forward string search command. String searches may be optionally terminated with a closing slash. To search for a slash use '\/' in the search string.
|
0 |
Move to the start of the current line. Also used within counts.
|
1-9 |
Used to add 'count' prefixes to commands.
|
: |
Prefix character for "ex" commands.
|
; |
Move: repeat last t, T, f, or F command.
|
< |
left shift operator
|
> |
right shift operator
|
? |
(move) String search backwards (reverse of / )
|
[[ |
Move backward one C function.
|
]] |
Move forward one C function.
|
| |
Move to the column given by the preceding count.
|
{ |
Move backwards one blank line delimited paragraph
|
} |
Move forwards one blank line delimited paragraph
|
Uppercase letters[edit]
A |
Append at the end of the current line.
|
B |
Move backward one blank-delimited word.
|
C |
(insert) Change the rest of the current line.
|
D |
Delete the rest of the current line.
|
E |
Move to the end of a blank-delimited word.
|
F |
(Move) Find a character backward on the current line.
|
G |
Move (Go) to the given line number (end of file, by default).
|
H |
Move to the first non-white char. on the top screen line.
|
I |
Insert before the first non-white char. on the current line.
|
J |
Join two lines.
|
L |
Move to the first non-white char. on the bottom screen line.
|
M |
Move to the first non-white char. on the middle screen line.
|
N |
Reverse the last string search.
|
O |
Open a new line above the current line, and start inserting.
|
P |
Put the yank/delete buffer before the current cursor position.
|
Q |
quit vi and go to ex mode (type vi to come back)
|
R |
Replace characters until esc is typed
|
S |
Change entire current line (insert)
|
T |
(Move) Reverse search 'upto' the given character.
|
U |
Undo all (recent) changes on current line
|
W |
Move forward one blank-delimited word.
|
X |
Delete one character before the cursor.
|
Y |
Yank the current line. Same as 'yy'.
|
ZZ |
Exit from the editor, saving changes if necessary.
|
Lowercase letters[edit]
a |
Append text after the cursor.
|
b |
Move back one word.
|
c |
change operator (insert)
|
d |
delete operator
|
e |
Move to the end of a word.
|
f |
(move) Find a character on the current line.
|
h |
Move left one column.
|
i |
Insert text before the cursor.
|
j |
Move down one line.
|
k |
Move up one line.
|
l |
Move right one column.
|
m |
Set a mark at the current position (e.g. ma or mb).
|
n |
(move) Repeat the last string search.
|
o |
Open a new line and start inserting text.
|
p |
Put the yank/delete buffer after the cursor.
|
r |
Replace a character (count replaces several with one character repeated)
|
s |
Replace characters (use count to replace several, enters insert mode)
|
t |
Move forward 'upto' the given character on the current line.
|
u |
Undo the last edit.
|
w |
Move forward one word.
|
x |
Delete the character under the cursor.
|
y |
yank operator
|
z |
Redraw the screen with the current line at the top (zRETURN), the middle (z.), or the bottom (z-).
|