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 advantage of having the swap in the same directory as the editfile, is that it can always be spotted if you try to edit the same file in two instances of Vim at the same time, or to reopen a file which wasn't properly closed because of a crash.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
118. You are on a first-name basis with your ISP's staff.

Reply via email to