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

How do I jump forward through the list of positions where I made changes?

Answer

g,

Explanation

Vim maintains a changelist — a record of every position where text was changed in the current buffer. g; jumps backward through this list (to older changes) and g, jumps forward (to newer changes). Together they let you navigate your edit history positionally, jumping exactly to where you were working.

How it works

Motion Direction
g; Jump to position of previous (older) change
g, Jump to position of next (newer) change
  • Each change records a line and column position
  • The list is per-buffer and persists for the session
  • After jumping back with g;, use g, to return forward

View the changelist

:changes

Output:

change line  col text
    3    15    8 old line content
    2    42   12 another changed line
    1    78    0 most recent change
>

The > marks the current position in the list.

Example workflow

You edited three different parts of a file. Now you want to review each edit:

g;    " jump to last edit position
g;    " jump to the one before that
g,    " come back forward one

Tips

  • g; is different from '' (jump to last jump position) — g; specifically tracks edit locations, not navigation jumps
  • The changelist can hold up to 100 entries per buffer
  • . (backtick dot) jumps to the position of the **last** change only — g;/g,` navigate the full history
  • Combine with :changes to see the full list and plan your navigation
  • Works across undo/redo — the changelist records positions chronologically regardless of undo state

Next

How do I run a search and replace only within a visually selected region?