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

How do I move the cursor just after each search match instead of at match start?

Answer

/pattern/e+1<CR>

Explanation

Most Vim searches place the cursor at the start of the match. For many editing workflows, that is inconvenient: you often want to append text after a token, add punctuation, or trigger a motion relative to the match end. Search offsets let you keep one search pattern but control exactly where the cursor lands.

How it works

  • /pattern performs a forward search
  • /e changes the cursor target from match start to match end
  • +1 moves one character beyond that end position
  • Combined as /pattern/e+1, each n repeat lands just after the match, ready for append-oriented edits

Example

Given:

item_1 item_2 item_3

Run:

/item_/e+1

The cursor lands immediately after item_ in each match cycle, which is useful when you want to append or tweak the suffix quickly across repeated occurrences.

Tips

  • Use /e without +1 to land exactly on the final character of the match
  • Negative offsets are valid too (for example /pattern/e-2)
  • This combines well with cgn and dot-repeat workflows when editing many similar matches

Next

How do I merge consecutive edits so they undo in a single step?