Vim tracks all of the changes you make during an editing session. You can undo and redo these changes with u
and Ctrl-r
. You can even navigate back and forth through history like a time traveller. But Vim has another useful change tracking feature: the changelist.
Vim keeps track of the position of every undo-able change and makes the last 100 available to you when you call :changes
. You can navigate backwards and forwards to these positions in your file without undoing the change by using g;
and g,
:
:changes
- Show position of last 100 changesg;
-Jump backwards to the position of the previous changeg,
- Jump forwards to the position of the next change
Here’s a short screencast showing this in practice. Click through the gif if you want to watch a slightly longer version in video form. (👋Thank you for your feedback, everyone. Keep it coming.)
Next steps:
Read more in the docs with
:help changelist
.Tweet out this tip. (Thanks!)
A note from the authors…
We are still experimenting with the gif vs. video format, so thank you for the feedback and let us know what you think. For more of these short videos, subscribe to our YouTube channel, and 🔔hit ‘dat bell icon! 🙄
You can also get a daily Vim tip from our archives by following our Twitter account. This is great for reinforcement because retention of these tips often requires repetition.
Was this useful? Help us improve!
With your feedback, we can improve VimTricks. Click a link to vote: