Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers 3

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.