Do not save backups if svn has a working copy?

I like that vim automatically saves backup files, but it is annoying when I use vim to edit the file that is in the working copy of svn, since the files are already “copied” and this creates a mess.

How to configure vim to only save backups when I edit a file that is NOT in the working copy of svn?

+4
source share
2 answers

Not the answer to your specific question, but I find the best solution. Why not back up all your files to a separate directory, regardless of whether they are in the original control?

Here's how, from my .vimrc. This creates backups in the ~ / .vim_backups shared 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 //
+13
source

See the backupdir option in vim (type: help backupdir) for creating backup files elsewhere. You can put the definition of "backupdir" in your ~ / .bashrc.

Another point - you can still create backup files, even if the file is managed by svn, since the backup will contain your local changes (not checked)

+1
source

All Articles