Reputation: 1099
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.)
Upvotes: 8
Views: 1134
Reputation: 392893
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
Upvotes: 5
Reputation: 196486
You should be using some kind of version control: Git, Mercurial, Subversion, whatever…
Each morning you can read your project's log and go through previous commits to see what changed, you can create branches to work on specific features, you write clean and descriptive commit message in order to better understand your previous changes, etc.
Or you could do something like :windo u
. But that sounds messy.
Upvotes: 1