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/.swpEdit your .vimrc file by opening vim and typing:
:edit $MYVIMRCThen, 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.