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

When my PC crashes for some reason and I open my files again in vim, it asks me to perform recovery on previously opened files. The recovery plugin helps a lot, but in 90% of cases the recovered data is identical to the actual file content. Is there a way how to let vim automatically discard the recovery data in such a case and not prompt me about it?

share|improve this question
There's no built-in automatic way to do it, but the plugin you refer to has all the pieces you need to do this yourself. The plugin detects and intercepts the swap file warning message; it knows whether the contents have changed (it displays the value of 'modified'); it can delete the swap file (e.g., the :FinishRecovery command). All you have to do is hack the plugin so that on detection of a swap file, if the file was not 'modified', delete the swap file and let you continue uninterrupted. It might be a good idea if it used :echomag to tell you that it did that. – garyjohn Aug 17 '13 at 19:07
up vote 3 down vote accepted

I'm the author of the Recovery plugin. It should be possible by setting the variable

let g:RecoverPlugin_Edit_Unmodified=1

in your .vimrc.

share|improve this answer

You must log in to answer this question.

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