On Fri, 5 Feb 2010, John Little wrote:

> 
> > I would like to have date.time stamped backups.
> >
> > How is that done within vim?
> 
> This is the script I use presently:
> 
> function! StampBackup()
>     let bup = globpath(&backupdir, expand('%:t') . &bex)
>
> [...]
>
> The obvious deficiency is that information about the location of the 
> edited file is not kept, so if you have the same name in use in 
> several places  (f. ex. Makefile) it's problematic telling them apart.

I like the way the 'directory' option with a value ending in // handles 
that:

e.g. I have:

set directory=~/.vim-tmp//

And in that directory I get files like:

%home%bhaskell%some%directory%filename.pl.swp

A similar name scheme could work here, too:

instead of:
>     let bup = globpath(&backupdir, expand('%:t') . &bex)
how about:
     let bup = globpath(&backupdir, substitute(expand(%:p),'/','%','g').&bex)

-- 
Best,
Ben

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to