Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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..

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
    
This is what I was looking for... Thanx – asdfg Feb 26 '10 at 5:08
    
+1 Nice. Seems there's a vim plugin for everything :-). – sleske Feb 26 '10 at 10:42

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.

share|improve this answer
4  
or you could use source control. – Rook Feb 25 '10 at 11:43
    
I have a source control system.. I wanted to revert state in one editing session... small changes... Thanx.. – asdfg Feb 26 '10 at 5:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .