As a developer who grew up on hardware with no MMU I have a habit of saving my work often, usually after every insert. Thus, when presented with the recovery dialogue after a crash or disconnect there is a very high probability that there were no unsaved changes and that the swapfile is identical to the saved file. I would like to reduce the friction between me and vim when trying to open files in this case.
Here is a recent example from the message shown to me when I edit a file after an unclean shutdown:
E325: ATTENTION Found a swap file by the name "~/.vim/swapfiles/algorithm_params.h.swp" owned by: ana dated: Thu Jan 11 16:09:00 2018 file name: ~ana/src/algorithm_params.h modified: no user name: ana host name: anavirt process ID: 8932 While opening file "src/algorithm_params.h" dated: Thu Jan 11 16:08:55 2018 (1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r src/algorithm_params.h" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/home/ana/.vim/swapfiles/algorithm_params.h.swp" to avoid this message. Swap file "~/.vim/swapfiles/algorithm_params.h.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
Ideally, I don't even want to see this dialogue. From what I understand, vim has the information necessary, but I may be wrong on these:
modified: nomeans that it knows that the swap file is identical to the saved file.
process ID: 8932means that the process used to generate this file is no longer running, otherwise it would say (still running).
Is there any way to tell vim to just delete the swapfile and edit the main file without even asking, if these two conditions are met, and otherwise pop up this dialogue as usual?