Using Vim as a time machine

If you're editing a file in Vim you can rewind time to a previous version of the file with the earlier command. You can go backwards (or forwards) in the history of a file based on a given time measurement. This can be helpful if you mess up your file and just want to rollback to a previous version.

:earlier 5m

or

:later 5m

Reddit had some interesting discussion on what you can do with this feature.

Note: Alternately you can use :e! to reload the file from disk if you haven't saved since your mess up.

Leave A Reply
All content licensed under the Creative Commons License