vimtricks.wiki Concise Vim tricks, one at a time.

How do I use count prefixes to amplify motions and operators in Vim?

Answer

{count}{motion}

Explanation

Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action. Mastering counts transforms basic motions into precision tools — jumping exactly 5 words, deleting 3 lines, or indenting 2 levels.

How it works

  • {count}{motion} — repeat the motion count times
  • {count}{operator}{motion} — apply operator over count repetitions
  • Counts can be used with operators, motions, and even combined
  • 2d3w = delete 6 words (2 × 3w)

Example

5j    — move down 5 lines
3w    — move forward 3 words
4dd   — delete 4 lines
2>>   — indent current line 2 levels
10k   — move up 10 lines
3p    — paste 3 times
Before 3dw:
the quick brown fox jumps

After:
fox jumps

Tips

  • Use :set relativenumber to see exact counts for vertical jumps
  • v3aw in visual mode selects 3 words
  • Some commands interpret count differently: 3J joins 3 lines, not J three times
  • Combine with repeat: 5. repeats the last change 5 times
  • In insert mode, <C-o>5j executes a single normal command with count

Next

How do I return to normal mode from absolutely any mode in Vim?