I use MacVim (snapshot 51)
to edit a the Python/HTML/etc files in moderately sized project. Every few months my system locks up or crashes, and Vim leaves a plethora of .*.swp files around. When I go to re-open Vim after the crash and edit any of those files, I am told "Swap file ''.xyz.swp'' already exists!" with the options of [Abort] [Quit] [Delete it] [Recover] [Edit anyway] and [Open Read-Only].
This recovery option would make sense if there were changes to the Vim buffer that hadn't been saved at the time of the crash. However, at the time of the crash these files were opened in the background of Vim, and unchanged.
If possible, how can I configure Vim to not ask this superfluous question when opening files for which there are no changes between the .swp
file and the actual file, e.g. by one of:
Automatically comparing the changes in the .swp file to the file, and if there are no changes then just opening the file without prompting;
Not keeping a .swp file for files that have no changes.
Any other means of systematically avoiding this pointless prompt (but I'd prefer not to avoid the prompt in cases where, of course, there were unsaved changes).
I have over fifty .swp
files to clean up at the moment, and the pointless prompt is a frustration I'd be grateful to avoid.
Thank you for reading.
Brian
:q
, but the swap files nevertheless seem to be hanging around for buffers in the background. Perhaps that's more my problem. I don't see anything in~/.vimrc
that would keep buffers around ... (Incidentally, what doesCtrl+Z
do? It doesn't seem to do anything in MacVim)Ctrl+Z
kills a process that's been launched from a shell (Terminal). Since you're using MacVim it doesn't apply to your situation, but you might try it from your Terminal sometime…Ctrl-Z
doesn't kill anything. It suspends the process. (But not in GUI Vims.) That lets you get back to the shell, do some things, and bring Vim back up again. If you kill the shell in the meantime (say, by closing the terminal window) you will kill Vim.[ctrl] + [z]
on GNU/Linux. If so: The reason it doesn't work is because it's up to the target to close. It just sends a signal (SIGTERM) to the target. This tells it to terminate, but target decides the implementation, so it can just ignore. Another signal, SIGKILL, doesn't give it the option. It is the result of usingpkill
command and the like via terminal.