Vim Swap Files Not Deleting

2019-08-11 08:10发布

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!

标签: vim macvim
2条回答
乱世女痞
2楼-- · 2019-08-11 08:44

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!

查看更多
姐就是有狂的资本
3楼-- · 2019-08-11 09:03

You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog 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.

查看更多
登录 后发表回答