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

How do I cycle through positions where I made changes?

Answer

g;

Explanation

The g; command moves backward through the change list, jumping to positions where edits were made. This lets you revisit your editing history without using marks.

How it works

  • g; moves to the previous change position (older)
  • g, moves to the next change position (newer)
  • Vim records the position of each change automatically

Example

You edit line 10, then line 50, then line 80. Pressing g; from line 80 takes you back to line 50. Pressing g; again takes you to line 10.

Tips

  • :changes displays the full change list
  • The change list is separate from the jump list
  • Up to 100 changes are remembered
  • Each buffer has its own change list

Next

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