"--Incremental backups, will copy the backup file to a specific backup
"directory and follow the tree structure of the file's directory
"This allows for backup up from multiple drives (on Windows) and easy
"navigation through the backups afterwards.
"Thanks to Tim Doerfler (TIP#892) for the extension part of this script
:let this_root_backup_dir="c:\\vim\\backups"
:let this_dir=substitute(expand("%:p:h"), "\\s", '_', 'g')
:let this_filename=substitute(expand("%"), "\\s", '_', 'g')
:let this_drive=strpart(this_dir,0,1)
:let this_backup_dir_drive=this_root_backup_dir."\\".this_drive
:let this_backup_dir=this_backup_dir_drive."\\".strpart(this_dir,3)
"--make DRIVE directory if it doesn't exist
if filewritable(this_backup_dir_drive)==0
sil exe expand("!mkdir ".this_backup_dir_drive)
endif
"--make directory under DRIVE if it doesn't exist
if filewritable(this_backup_dir)==0
sil exe expand("!mkdir ".this_backup_dir)
endif
"--set new backup dir
exe expand("set backupdir=".this_backup_dir)
"+++++++++ END Auto backups +++++++++++++++++++++++++++++++++++++++