Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How does one disable swap files for VIM via .vimrc?

share|improve this question
add comment

4 Answers

up vote 11 down vote accepted
set nobackup
set nowritebackup
set noswapfile
share|improve this answer
2  
Backup 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. –  John T Oct 28 '09 at 14:33
4  
i'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. –  quack quixote Oct 28 '09 at 15:40
2  
I 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. –  Nerdling Oct 28 '09 at 17:55
add comment

Throw this into your .vimrc:

set noswapfile
share|improve this answer
add comment

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
share|improve this answer
add comment

start vim with the "-n" argument:

vim -n <file>

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.