I installed vim on windows 10 using chocolatey. When I edit a foo file in powershell, vim leaves behind .foo.un~ or .foo~ files. What are these and how do I stop vim from leaving them around?

1 Answer

These files are backup and undo files. vim also creates swap files if it crashes while editing.

From

In powershell, create the following directories:

~/.vim ~/.vim/.undo ~/.vim/.backup ~/.vim/.swp 

Edit your .vimrc file by opening vim and typing:

:edit $MYVIMRC 

Then, add the following lines, and save:

set undodir=~/.vim/.undo// set backupdir=~/.vim/.backup// set directory=~/.vim/.swp// 

vim will now put your undo, backup, and swap files in the ~/.vim/.undo, ~/.vim/.backup, and ~/.vim/.swp directories, respectively.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy