When I open a file for which Vim sees that there is a swap file present, it warns me and gives me some options, like "[A]bort" and "[E]dit anyways". However, one option it used to show me but no longer does is to "[D]elete" the swap file. How can I get it to show this option again?
How can I see the option in Vim to "[D]elete" a swap file?
345 views Asked by meisel At
1
As posted on the vi stack exchange site by Martin Tournoij:
The "Delete it" option isn't displayed if the Vim process is still running; I can't find this documented anywhere but I looked it up in the source code; from
memline.c
, line 4512 (slightly simplified):The swap file embeds the process ID which created it, and if a process with that PID still exists it considers the process to be "running".
The swap message should display this information:
Note the
process ID: 17355 (still running)
line.The most likely scenario is that you have another Vim instance running somewhere :-) You could
kill
it if you can't find it.There is a small chance that the PID got re-used by another process though, in which case your only option is to quit Vim, manually remove the swap file, and restart it again: