Can we set a restore point and restore a file's state while editing the file with VIM?...
I saw the "earlier" and "later" commands. But what if i dont remember the exact time to go back. So I want to know if there is a way to set restore points (and name them if possible) and restore the file using the restore point? Thanks..
2 Answers
There's no built in way to do this, but there's a superb plugin available here that allows you to do :UTMark tagName
to mark the current state in the undo tree and use :UTMark tagName
to restore that state.
Overall, using a source control system is much better for general long term history, but this can be useful for navigating small changes.
No, not that I'm aware of.
But you could just write (:w file) your file to a new name (e.g.with date+time appended). This will keep the original filename in your buffer (so :w, :x will continue to work normally).
If you write the temp files to a temp directory, the OS can clean them up automatically. For bonus points, make that into a small vim macro, so you can invoke it with one key.
-
4
-
I have a source control system.. I wanted to revert state in one editing session... small changes... Thanx..– asdfgFeb 26, 2010 at 5:09