Friday, August 12, 2011

Re: vim swap files

On Aug 11, 5:49 pm, Gary Johnson <garyj...@spocom.com> wrote:
> On 2011-08-11, cyboman wrote:
> > i set my backup and swap directories to
>
> > ~\vimfiles\data\swap
> > ~\vimfiles\data\backup
>
> > however at my work i very often have to edit two different revisions
> > of the same project, meaning that quite often i have vim open two
> > files in different directories with the same name. because of the my
> > setting for backup and swap files this causes them to store in the
> > same location under the same name. does anybody know of a way of
> > giving unique names to the swap files and backup files.
>
> > example:
>
> > \home\myFirstProject\file.c
> > \home\mySecondProject\file.c
>
> > vim will store
> > ~\vimfiles\data\swap\file.c.swp
> > ~\vimfiles\data\backup\~file.c.swp
>
> > for both projects.
>
> > what i want is
>
> > ~\vimfiles\data\swap\uniqueNameForMyFirstPeojctfile.c.swp
> > ~\vimfiles\data\swap\uniqueNameForMySecondPeojctfile.c.swp
> > ~\vimfiles\data\backup\~uniqueNameForMyFirstPeojctfile.c.swp
> > ~\vimfiles\data\backup\~uniqueNameForMySecondPeojctfile.c.swp
>
> > any help is appreciated
>
> For swap files it's easy:  just put two slashes at the end of each
> directory name in the 'directory' option, e.g.,
>
>     set directory=~/tmp/vimswap//,$TMP//,$TEMP//
>
> That will generate a unique name for each swap file based on the
> full path name of the original file.  See
>
>     :help 'directory'
>
> Unfortunately the same feature does not exist yet for backup
> files.  It's still an item in the todo list, but at least it's in
> the "known bugs and current work" section, so maybe it's coming
> soon.
>
> In the mean time, you may want to turn off the 'backup' option and
> create your own backups using a BufRead autocommand or one of the
> backup plugins.
>
> Regards,
> Gary

thanks for the help everyone. i'll wait till the full feature for the
backup will be implemented but will use the swap file with a full name
feature.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: