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

How do I move backward to the end of the previous word?

Answer

ge

Explanation

The ge motion moves the cursor backward to the end of the previous word. This fills the gap left by b (which goes to the beginning of the previous word).

How it works

  • ge moves backward to the last character of the previous word
  • Useful when you need to position at the end of a word behind the cursor
  • Counts work: 3ge goes back three word-ends

Example

hello world

With the cursor on w, pressing ge lands on o (end of hello).

Tips

  • gE moves backward to the end of the previous WORD (whitespace-delimited)
  • e is the forward counterpart
  • dge deletes backward to the end of the previous word
  • Combine with cge to change backward through a word ending

Next

How do you yank a single word into a named register?