1

I believe this happens after Windows returns from Sleep. The problem goes away when I restart VIM. I use VIM 8.1.

My vimrc contains:

set nobackup
set noswapfile
set noundofile

silent execute '!mkdir "'.$TMP.'/vim"'
set backupdir=$TMP/vim/

The solution in Vim error E510: Can't make backup file (add ! to override) didn't help me, since I don't use backups (as far as I know).

Andreas Haferburg
  • 5,189
  • 3
  • 37
  • 63
  • 1
    Regarding `backupdir`: You might want to add a second `/` at the end, making it `set backupdir=$TMP/vim//`. From `:help backupdir`: "if a directory ends in two path separators "//", the backup file name will be built from the complete path to the file with all path separators changed to percent '%' signs. This will ensure file name uniqueness in the backup directory." – Ralf Feb 14 '19 at 05:19

1 Answers1

2

Vim still writes a backup file to protect from failures during writing. This backup file is deleted after writing was successful. It can be disabled, but if writing fails then, the file is destroyed.

Read about it with :help 'writebackup' and :help backup.


Before disabling all the backup stuff, you might want to check the option backupdir. With it you can define a central directory, where all backup files are stored. So your working directories don't get flooded with *~-files. See :help backupdir.

BTW: With disabling swapfile, Vim cannot recover after a crash. I hope you know what you are doing.

Ralf
  • 1,773
  • 8
  • 17
  • Thank you for the pointer. I edited my question. Maybe the backupdir in `%TMP%` is cleaned up by Windows. It's a shame really that we as users have to manage this. All options have downsides. – Andreas Haferburg Feb 13 '19 at 14:39