I think the better solution is to place these lines in your vimrc file
set backupdir=~/vimtmp//,.
set directory=~/vimtmp//,.
The first line is for backup files, the second line for swap files. The double slash at the end ensures that there is no conflict in case of two files having the same name, see comments (at the time of this edit this option is only honored for swap files, not yet for backup files). The ,.
allow vim
to use the current directory if the former doesn't exist.
You have to create a directory in your home directory called vimtmp for this to work. Also, check that backups are enabled in your config (add set backup
if not).
That way you get the benefit of both worlds, you don't have to see the files, but if something does get futzed you can go get your backup file from vimtmp. Don't forget to clean the directory out every now and then.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…