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?

2 Answers 2

6

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)
3
  • 1
    i put these backupfiles to $TEMP, otherwise +1
    – akira
    May 10, 2010 at 18:50
  • I didn't write that article there, I just quoted.
    – Joey
    May 10, 2010 at 18:58
  • What file should I write these lines to?
    – IDK
    Oct 11, 2020 at 18:26
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .