vi Control Mode Commands

The material in this section also appears in Learning the bash Shell by Cameron Newham (O’Reilly).

Table A-24 shows a complete list of readline vi control mode commands.

Table A-24. vi mode commands

Command

Meaning

h

Move left one character.

l

Move right one character.

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.

.

Repeat the last a insertion.

^

Move to first nonblank character in line.

$

Move to end of line.

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

Overwrite existing text.

dh

Delete one character backward.

dl

Delete one character forward.

db

Delete one word backward.

dw

Delete one word forward.

dB

Delete one nonblank word backward.

dW

Delete one nonblank word forward.

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).

x

Equivalent to dl (delete character forwards).

X

Equivalent to dh (delete character backwards).

k or -

Move backward one line.

j or +

Move forward one line.

G

Move to line given by repeat count.

/string

Search forward for string.

?string

Search backward ...

Get bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.