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

How do I view the list of positions where I made edits in Vim?

Answer

:changes

Explanation

How it works

Vim maintains a change list that records the position of every change you make to a buffer. The :changes command displays this list, showing you exactly where every edit occurred.

Each entry shows:

  • A number indicating its position relative to the current entry.
  • The line number and column where the change was made.
  • The text at that line.

The entry marked with > is your current position in the change list.

You navigate the change list with:

  • g; to jump backward to the position of the previous (older) change.
  • g, to jump forward to the position of the next (newer) change.

The change list is different from the jump list. While the jump list records every large cursor movement, the change list only records positions where you actually modified text. This makes it especially useful for finding your way back to code you were actively editing.

Example

After making several edits across a file, run :changes:

change line  col text
    3    15    8   let config = load();
    2    42    4   console.log(result);
    1   108   12   return output;
>   0    75    0   const total = sum(values);
  1. Press g; to jump to line 108 where you last edited return output;.
  2. Press g; again to jump to line 42.
  3. Press g, to come forward again to line 108.

Tips

  • The change list stores up to 100 entries per buffer.
  • Unlike the jump list which is per-window, the change list is per-buffer.
  • The `. mark always points to the position of the last change, giving you instant access to the most recent edit.

Next

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