How to Hide or Delete Files created by Vim in Windows?

3

Whenever I open a file with Vim, the program automatically creates a copy of the file ending with a tilde~

When I'm done editing a few files, the folder is littered with extraneous files ending in ~

Is it possible to have Vim automatically remove said files? Or as an alternative, is it possible to have Windows hide them?

Hayek

Posted 2010-05-09T21:45:33.327

Reputation: 1 527

Answers

5

From here:

Backup Files

Vim by default creates a backup of an edited file in the same directory as the file called filename~. To prevent clutter, many users tell vim to use a backup directory:

set backupdir=~/.vim/backup,/tmp

Or, it's possible to even disable this behaviour:

set nobackup
set nowritebackup
set noswapfile    ! (additionally disable swap files)

Joey

Posted 2010-05-09T21:45:33.327

Reputation: 36 381

1i put these backupfiles to $TEMP, otherwise +1 – akira – 2010-05-10T18:50:35.147

I didn't write that article there, I just quoted. – Joey – 2010-05-10T18:58:20.080

1

Also see my "autohide" plugin for hiding those pesky files that oh-so-occasionally become a life saver.

Ben F

Posted 2010-05-09T21:45:33.327

Reputation: 11