July 30th, 2009 Add Your Comments

Vim has several advanced ways of undo the changes made in file, however, I’m not going to go into all of them here but just show you one.  The :earlier and and :later command in vim can move you backwards and forwards in time through your change history.  Very much like Time Machine in OSX.

Note: This is NOT a substitution for source control!

:earlier {count}	Go to older text state {count} times.
:earlier {N}s		Go to older text state about {N} seconds before.
:earlier {N}m		Go to older text state about {N} minutes before.
:earlier {N}h		Go to older text state about {N} hours before.
:later {count}		Go to newer text state {count} times.
:later {N}s		Go to newer text state about {N} seconds later.
:later {N}m		Go to newer text state about {N} minutes later.
:later {N}h		Go to newer text state about {N} hours later.

Below are some links to more information about :earlier and :later as well as other undo features.

http://vimdoc.sourceforge.net/htmldoc/usr_32.html
http://vimdoc.sourceforge.net/htmldoc/undo.html#undo-branches