-1

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?

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

1 Answers1

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