In vim, I would like to undo through all changes in all buffers, in chronological order.
e.g., in a vim session I typically have many tabs open, with many windows in each tab. Using u
to undo (or g;
/ g,
to move though the changelist), vim moves through changes made to that buffer, even if there are more recent made changes in other buffers. (Which I admit, is what I want most of the time.)
But is there a way to move back through changes in all buffers in chronological order? (I imagine vim would jump around from tab to tab, which would be ok.)
Why would this be useful? ... mostly so when I resume coding after a break I can remind myself of "where I'm up to", i.e all the changes I made last time.
(Using macvim 7.3)
UPDATE: responses about using git / mercurial make good points (thanks especially for git stash
), but I'd still find this feature useful as it steps me back through recent changes, in order, with syntax coloring, inside vim etc.)
You could come a long way with undolist
:
:bufdo echo expand('%') | undolist
Results in, e.g. for a simple editing session:
SpiritParser.cpp
number changes when saved
1 1 13:57:51
SpiritParser.h
number changes when saved
1 1 13:57:55
To do this for all visible windows, do windo
instead of bufdo
. If you have multiple tabs, make that
:tabdo windo echo expand('%') | undolist
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With