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 deleted some lines in a text file with gvim (ma, <move cursor>, d`a), saved and closed gvim. I realized I'd deleted the wrong lines, and opened a new gvim and opened the file, but 'p' did not re-paste the cut lines. The backup file had the version with lines deleted (presumably when I reopened the file it deleted the previous backup).

Is there any way of recovering the missing lines? I have windows 7 and have got shadow copies turned off for the volume.

share|improve this question

migrated from stackoverflow.com Nov 18 '12 at 15:40

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

You need to set undofile option in your .vimrc:

:set udf
share|improve this answer
add comment

With Vim 7.3, if you had :set undofile (persistent undo), you could have simply pressed u to undo.

Too bad that p didn't work; you could still manually check the _viminfo file for the lost contents.

I hope you use this occasion to rethink your backup strategy, various revision control systems are available and quite simple to use. For file system locations where this is not feasible, I use a lightweight alternative in the form of the writebackup plugin.

share|improve this answer
add comment

Your Answer

 
discard

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