vfkqva
Last Updated: February 25, 2016
·
1.523K
· joegardiner
Aaf5f1295700a133d2fb321635465c38

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

Say Thanks
Respond

3 Responses
Add your response

3159

That is awesome. I never knew that was possible.

over 1 year ago ·
3160
102c186d329cadf098b9ef8e97ffc9ff

Also: Use :e! to revert to the last saved version.

over 1 year ago ·
3163
Blackbeard pirate movie crop

I also recommend the Gundo plugin. http://sjl.bitbucket.org/gundo.vim/

over 1 year ago ·