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?
Asked
Active
Viewed 197 times
-1

Heath Borders
- 30,998
- 16
- 147
- 256
-
2Heath, could you please refrain from posting questions specific to software on a programming questions site, _(three questions all specfic to VIM)_. Please use [Super User](https://superuser.com/questions/ask) for software related issues. – Compo Jun 28 '20 at 12:46
-
Thanks. I'll move it there. – Heath Borders Jun 28 '20 at 16:03
-
Moved to superuser: https://superuser.com/q/1564618/42083 – Heath Borders Jun 29 '20 at 05:10
1 Answers
1
These files are backup
and undo
files. vim
also creates swap
files if it crashes while editing.
From https://coderwall.com/p/sdhfug/vim-swap-backup-and-undo-files
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.

Heath Borders
- 30,998
- 16
- 147
- 256