Cover by Linda Lamb, Elbert Hannah, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

vi Commands

vi supplies a large set of single-key commands when in command mode. Vim supplies additional multikey commands.

Movement Commands

Some versions of vi do not recognize extended keyboard keys (e.g., arrow keys, page up, page down, home, insert, and delete); some do. All versions, however, recognize the keys in this section. Many users of vi prefer to use these keys, as it helps them keep their fingers on the home row of the keyboard. A number preceding a command repeats the movement. Movement commands are also used after an operator. The operator works on the text that is moved.

Character

h, j, k, l

Left, down, up, right (, , , )

Spacebar

Right

BACKSPACE

Left

CTRL-H

Left

Text

w, b

Forward, backward by “word” (letters, numbers, and underscores make up words).

W, B

Forward, backward by “WORD” (only whitespace separates items).

e

End of word.

E

End of WORD.

ge

End of previous word. {Vim}

gE

End of previous WORD. {Vim}

), (

Beginning of next, current sentence.

}, {

Beginning of next, current paragraph.

]], [[

Beginning of next, current section.

][, [ ]

End of next, current section. {Vim}

Lines

Long lines in a file may show up on the screen as multiple lines. (They wrap around from one screen line to the next.) Although most commands work on the lines as defined in the file, a few commands work on lines as they appear on the screen. The Vim option wrap allows you to control how long lines are displayed.

0, $

First, last position of current line.

^, _

First nonblank character of current line.

+, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required