Search code examples
vimcygwin

vim creates swap file every exit, complains each future edit


I'm using vim 7.4 within cygwin on a Windows 10 OS. Every single time I edit a file with vim, it seems to leave a .swp file in the directory. The next edit of that file complains about an existing swap file. This is very annoying.

I know I can disable the creation of swap files, but I've used vim on many other machines and this is the only one that appears to have this issue. There must be some explanation for why vim isn't deleting these files?

FYI - I'm using :wq to save my edits and quit.


Solution

  • You may find that you have another instance of VIM open with the file and it is the owner of the swap file. This can happen if you accidentally pressed "Ctrl+Z" which is fairly easy if you're a windows user (undo shortcut).

    Run "ps -a" to see if there is another instance of vim running.