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

I realized I had deleted something for mistake when I typed :wq,then how can I rollback to the pre-version?Thank you!

share|improve this question
up vote 3 down vote accepted

If you have backups set, you could try looking in your backup folder. In my .vimrc I have a line that says

set backupdir=~/Backups

I can retrieve old versions from there.

share|improve this answer
I'll do that setting.Thanks. – SpawnST May 6 '10 at 7:09

If you haven't yanked or deleted anything since then it may still be in the yank buffer and you can paste it in any vim session to show/restore it.

share|improve this answer
I tried and did not get the right content in the buffer.:( – SpawnST May 6 '10 at 3:35
you must check all registers with :reg ! – u0b34a0f6ae May 9 '10 at 19:28

If you have Vim 7.3 (which was not available at the time this question was originally asked) you may enable persistent undo, where undo information is stored and remembered across Vim sessions, by putting in your ~/.vimrc:

:set undofile

You may also want to set the 'undodir' option. See:

:help 'undofile'
:help 'undodir'
:help persistent-undo

share|improve this answer

You must log in to answer this question.

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