tags:

views:

162

answers:

2

I like that vim automatically saves backup files, but it is annoying when I use vim to edit a file that is in a svn working copy, since the files are already "backed up", and it creates clutter.

How do I configure vim to only save backups when I am editing a file that is NOT in a svn working copy?

+12  A: 

Not an answer to your specific question, but I believe a better solution. Why not backup all your files into a separate directory, regardless of whether they are in source control?

Here's how, from my .vimrc. This creates the backups in the common ~/.vim_backups directory:

" Use a common directory for backups and swp files
" Create it if it doesn't exist
silent execute '!mkdir -p ~/.vim_backups'
set backupdir=~/.vim_backups//
set directory=~/.vim_backups//
hgimenez
not a bad idea...I just do that if I don't get any better suggestions.
Ken Liu
+1 love that
LB
+1  A: 

See backupdir option in vim (type :help backupdir) to create backup files in different location. You can put the definition of "backupdir" to your ~/.bashrc.

One additional point - you may still want backup files even if the file is controlled by svn, since backup will contain your local changes (not checked ones)

dimba
It's not worth it...I commit frequently enough so that this almost is never needed.
Ken Liu