Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim - don't save backups if in svn working copy?

Tags:

vim

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?

like image 218
Ken Liu Avatar asked Dec 10 '22 19:12

Ken Liu


1 Answers

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//
like image 63
hgmnz Avatar answered Feb 01 '23 05:02

hgmnz