Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running vim on windows leaves unwritable swap files behind

Tags:

vim

windows

swap

I am running Cygwin on windows. Several times now I've had a swap file left behind from vim after a crash, but it can't be recovered or deleted. "ls -l" shows this: -rw-r----- 1 Unknown+User Unknown+Group 12288 Feb 26 15:27 .pl.pl.swp

I'm not allowed to be an admin on my box, so I can't delete it. I'm not the owner so I cant' delete it either - it has unknown ownership.

Any ideas on how I can delete it (without pulling in a machine admin each time)? Can I have vim put its swapfiles in some other folder so at least they won't clutter up my working dir (I need the right .vimrc settings for running on windows)?

like image 963
smartyollie Avatar asked Feb 26 '15 23:02

smartyollie


1 Answers

You can disable swapfiles entirely with set noswapfile or, if you still want that feature but not the clutter, tell Vim to put those files in a dedicated location:

set directory=c:\\tmp

Note that you'll still have to delete existing swapfiles manually.

Read the following help sections for more information:

:help 'swapfile'
:help swap-file
:help 'directory'
like image 51
romainl Avatar answered Nov 14 '22 23:11

romainl