start page | rating of books | rating of authors | reviews | copyrights

Book HomeBook TitleSearch this book

B.10. vi Control Mode Commands

Here is a complete list of all vi-mode control commands. As for the emacs mode commands, the sequences such as "[ A" are for ANSI standard terminal arrow keys and were added for ksh93h.

Command Meaning
h Move left one character
[ D Move left one character (ksh93h and newer)
l Move right one character
space Move right one character
[ C Move right one character (ksh93h and newer)
w Move right one word
b Move left one word
W Move to beginning of next nonblank word
B Move to beginning of preceding nonblank word
e Move to end of current word
E Move to end of current nonblank word
0 Move to beginning of line
[ H Move to beginning of line (ksh93h and newer)
^ Move to first nonblank character in line
$ Move to end of line
[ Y Move to end of line (ksh93h and newer)
i Insert text before current character
a Insert text after current character
I Insert text at beginning of line
A Insert text at end of line
r Replace one character (doesn't enter input mode)
R Overwrite existing text
dh Delete one character backwards
dl Delete one character forwards
db Delete one word backwards
dw Delete one word forwards
dB Delete one nonblank word backwards
dW Delete one nonblank word forwards
d$ Delete to end of line
d0 Delete to beginning of line
D Equivalent to d$ (delete to end of line)
dd Equivalent to 0d$ (delete entire line)
C Equivalent to c$ (delete to end of line, enter input mode)
cc Equivalent to 0c$ (delete entire line, enter input mode)
s Equivalent to xi (delete current character, enter input mode)
S Equivalent to cc (delete entire line, enter input mode)
x Equivalent to dl (delete character backwards)
X Equivalent to dh (delete character forwards)
k or - Move backward one line
[ A Move backward one line (ksh93h and newer)
j or + Move forward one line
[ B Move forward one line (ksh93h and newer)
G Move to line given by repeat count
/string Search forward for string
?string Search backward for string
n Repeat search forward
N Repeat search backward
f x Move right to next occurrence of x
F x Move left to previous occurrence of x
t x Move right to next occurrence of x, then back one space
T x Move left to previous occurrence of x, then forward one space
yh Yank one character backwards
yl Yank one character forwards
yb Yank one word backwards
yw Yank one word forwards
yB Yank one nonblank word backwards
yW Yank one nonblank word forwards
y$ Yank to end of line
y0 Yank to beginning of line
Y Equivalent to y$ (yank to end of line)
yy Equivalent to 0y$ (yank entire line)
u Undo last editing change
U Undo all editing changes made to the line
. (dot) Repeat last editing command
| Move to absolute column position
; Redo last character finding command
, Redo last character finding command, but in opposite direction
%

Move to matching (, ), {, }, [, or ]

\ Do filename/command/variable completion
CTRL-I (TAB)

Do filename/command/variable completion (only for set -o viraw) (starting with ksh93h)

* Do filename/command/variable expansion (onto command line)
= Do filename/command/variable expansion (as printed list)
~ Invert ("twiddle") case of current character(s)
_ Append last word of previous command, enter input mode
v

Run the hist command on the current line (actually, run the command hist -e ${VISUAL:-${EDITOR:-vi}}); usually this means run the full vi on the current line

CTRL-J Same as ENTER
CTRL-L

Start a new line and redraw the current line on it

CTRL-M Same as ENTER
CTRL-V Print the version of the Korn shell
#

Prepend # (comment character) to the line and send it. If the line starts with #, remove the leading # and all leading # characters after any embedded newlines

@ x Insert expansion of alias _x as command mode input



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.