On 3/17/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Raphael Bauduin wrote:
> On 3/16/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
>> Raphael Bauduin wrote:
>> > Hi,
>> >
>> > When opening a file, is there a way to tell vim which name to use for
>> > the swapfile?
>> >
>> > I'm writing a little vim config file to edit a CMS' content in a DB.
>> > Each page has a parts named 'body', which the script makes available
>> > through
>> >    :Radiant edit pages/Home Page/body
>> > or, for another page:
>> >    :Radiant edit pages/Home Page/Articles/First Post/body
>> >
>> > The problem is that vim is using the same swapfile due to the last
>> > part of the path being body in both cases. I see 2 solutions to this
>> > problem: either use no swapfile (resetting swapfile), or specify
>> > another name for the swapfile, with a preference for the latter. I can
>> > specify the directory where to put swapfiles, but can I specify a name
>> > for the swapfile? Or can I set a swapfile directory specific to a
>> > buffer?
>> >
>> > Thanks in advance for your help.
>> >
>> > Raph
>> >
>> >
>>
>> IIUC, you can't specify the swapfile name; but (again, IIUC) the
>> default is to
>> write the swapfile in the same directory as the editfile: so you would
>> have
>>
>>         pages/Home Page/.body.swp
>>
>> and
>>
>>         pages/Home Page/Articles/First Post/.body.swp
>>
>> which are different files by virtue of being located in diferent
>> directories.
>
> The swapfile used is .body.swp , it doesn't seem to create the
> directories. I set directory=/tmp/ and the swapfile used is
> /tmp/body.swp .

That's the problem. If you set the swapfile to always be written to a fixed
directory, there will be collisions.

If 'directory' starts with . (as in the default), Vim will attempt to create
the swapfile in the same directory as the editfile. There will be no need to
"create" the directory since it already contains the file you're editing, and
for the same reason it should be writable.

This directory doesn't exist as the path is in fact mapped to a
database (see http://www.raphinou.com/radiant.vim/ , I'll post a new
release today). However, it works fine when I create the directory.
Thanks for your help on this!

Raph

PS: I saw after sending my previous mail I had mistakenly done a
'Reply' rather than 'Reply all'. Thanks for having redirected the
discussion on the ML. Mistakes do happen....

<snip>

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

Reply via email to