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

How do I jump to a literal search target without adding jump-list noise?

Answer

:keepjumps normal! /\Vtarget\<CR>

Explanation

Repeated navigational searches can pollute the jump list, especially when you are doing targeted inspections before returning to your main edit location. Pairing :keepjumps with a normal-mode search lets you move the cursor to a match without recording a new jump entry. Adding \V makes the pattern literal, so punctuation-heavy tokens are matched exactly.

How it works

  • :keepjumps suppresses jump-list updates caused by the following command
  • normal! executes raw normal-mode keys (ignoring user mappings)
  • / starts a forward search
  • \V switches to very-nomagic mode so most characters are treated literally
  • target is the exact text to find
  • <CR> executes the search

Example

Use this when scanning for an exact token, then returning with <C-o> to your prior meaningful jump history:

:keepjumps normal! /\Vtarget\<CR>
Before: jump list points to your true edit checkpoints
After:  cursor moves to "target" but no extra jump entry is added

Tips

  • Replace target with escaped text generated from your tooling when searching symbols that contain regex metacharacters.
  • Use ? instead of / inside normal! for backward literal jumps with the same no-noise jump behavior.
  • Combine with keeppatterns if you also want to preserve your previous / pattern.

Next

How do I allow block selections past end-of-line while still permitting one-char past EOL cursor movement?