Counts

Type a number before any motion or operator. It multiplies.

Keys: {n}

Most Vim commands accept a count prefix. 5j moves down 5 lines. 3dw deletes 3 words. Counts on both sides of an operator multiply.

Almost every Vim command accepts a numeric prefix. The number means "do this {n} times." That's it โ€” no escape sequence, no special key. Just type the digits, then the command.

Move down 5 lines
KeyNote
5
j
Delete 10 characters
KeyNote
1
0
x
Delete 3 words
KeyNote
3
d
w
Counts on motions
Counts on edits
Counts before operators
Counts on insert

Reference

Pattern Means
{n}{motion} Apply motion n times
{n}{op}{motion} Apply (op + motion) n times
{op}{n}{motion} Apply op once over (motion ร— n)
{n}{op}{m}{motion} Apply op (n ร— m) times over motion
{n}. Repeat last change with new count n

Worked example โ€” 5j and 3dw

Counts multiply motions and operators.

Step 1 ยท
counts.basics
Step 2 ยท 5j ยท 5j โ€” down five lines.
5j โ€” down five lines.
Step 3 ยท gg3dw ยท 3dw โ€” three words gone.
3dw โ€” three words gone.

Counts apply equally to motions and to operator+motion combos. 3dw == d3w == dwdwdw.

See also: The Universal Grammar, Delete, Dot with Counts