Vim is not deleting .swp files when I quit. I am using vim in iTerm (macvim) and quitting with :q
or :wq
or :qa
. My swap files seem to be sticking around. I have had to ad *.swp *.swo *.swn
to my .gitignore which is becoming frustrating to say the least and I'm sure it's confusing my clients and coworkers. They are filling my computer with needless files. And of course I have to step through the "Swap file exists" warning every time I open a file.
I'd like swap files to delete on quit. Failing that I'd like to find some way to clean them up automatically.
What are my options for diagnosing/solving this problem?
Thanks!
I came across the same problem (on a linux machine). For some reason, after editing files in a specific directory vim didn't delete the .swp files. The
vimlog
provided no useful information.However, deleting
~/.viminfo
fixed it!You can capture a full log of a Vim session with
vim -V20vimlog
. After quitting Vim, examine thevimlog
log file for suspect messages. I could imagine that even though Vim is able to create the swap files, it is somehow not able to delete them.