How does one disable swap files for VIM via .vimrc
?
4 Answers
set nobackup
set nowritebackup
set noswapfile
-
3Backup files can be useful if you need the original quickly. Also keep in mind that by turning off nowritebackup you risk destroying the file in case of an IO error.– user1931Oct 28, 2009 at 14:33
-
4i'd guess that disabling either backup or swapfile is reasonable, but not both. i disable the backups but the swapfile's saved my derriere a few times. Oct 28, 2009 at 15:40
-
2I really wouldn't be concerned about an IO error; I should like to think if it occurred, recovering my changes to the file are the least of my worries.– Jeremy LOct 28, 2009 at 17:55
I would not disable swap files completely because they are used for recovery if vim crashes.
Instead, put them into a temp folder so that they are not scattered all over:
if has("win32")
set directory=c:\\tmp,c:\\temp
elseif has("unix")
set directory=/tmp
endif