Vim

Vim: Motions

A motion is a command (in normal mode) that moves the cursor.

If the new position is off the screen, the screen is scrolled to show the cursor.

It all begins with the hjkl keys for left, down, up, and right movement by count characters. Think of j as a down arrow.

The motion commands can be used after an operator command to have the command operate on the text that was passed over. Typically this is done to delete or change text.

Common operators:

If the motion includes a count and the operator includes a count, the two counts are multiplied.

When doubling the operator it operates on a line.

7dd deletes 7 lines.

After applying the operator the cursor is mostly left at the start of the text that was operated on.

The operator either affects whole lines, or the characters between the start and end positions. Generally, motions that move between lines affect lines (are linewise), and motions that move within a line affect characters (are characterwise). But, there are exceptions.

Resources

:help cursor-motions

Tools

Web

Languages

Data