Revert documents in vim
You can revert files instead of using "u" to undo. It is not 100% accurate but can be useful if you've made a big mistake and need to revert an entire file back a rough number of minutes.
This creates a branch of the file you are editing.
Out of insert mode user the following commands:
:earlier (number of minutes)m
and...
:later (number of minutes)m
For example
:earlier 20m
You can also set more specific times by substituting m with the following:
s = seconds
m = minutes
h = hours
d = days
For example:
:later 4d
Written by Joe Gardiner
Related protips
3 Responses
That is awesome. I never knew that was possible.
over 1 year ago
·
Also: Use :e! to revert to the last saved version.
over 1 year ago
·
I also recommend the Gundo plugin. http://sjl.bitbucket.org/gundo.vim/
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#