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

How do I jump to the beginning of the next word?

Answer

w

Explanation

The w command moves the cursor forward to the beginning of the next word. It is one of Vim's most fundamental motions and is used constantly for navigating within a line.

How it works

  • w jumps to the start of the next word
  • A "word" in Vim consists of a sequence of letters, digits, and underscores, or a sequence of other non-blank characters
  • If the cursor is in the middle of a word, w skips to the beginning of the next word

Example

Given the text with the cursor on the T:

The quick brown fox

Pressing w three times moves the cursor: Tqbf, landing on the first character of each subsequent word.

Tips

  • Use b to move backward to the beginning of the previous word
  • Use e to move to the end of the current or next word
  • Use W (uppercase) to move by WORD — whitespace-delimited chunks that treat punctuation as part of the word (e.g., foo.bar is one WORD but two words)
  • Combine with operators: dw deletes to the start of the next word, cw changes to the end of the current word, yw yanks to the start of the next word
  • Use 3w to jump forward three words at once
  • Use 2dw or d2w to delete two words

Next

How do I edit multiple lines at once using multiple cursors in Vim?