9
1
When the Vim process is abruptly terminated (e.g. system crash), it leaves a SWP file. Opening the original file in Vim later gives the option of recovery. Most of the time the recovered file is the same as the saved file, because I have a habit of saving often. Then Vim says:
Recovery completed. Buffer contents equals file contents.
You may want to delete the .swp file now.
Well, of course I want to delete the .swp file now!
How can I get Vim to always delete the SWP file automatically in this case?
There seems to be no built-in setting to do this, so I'm looking for an appropriate autocommand event.
One way I found is to :e #
after the message, which causes the swap-exists options to appear again, then I can "Delete It". But I shouldn't really have to do those extra steps each time.
Thanks! I found your
:e #
trick is, albeit not ideal, but still more useful than the current answer below. :-) – RayLuo – 2017-12-01T08:09:06.813