Thursday, September 13, 2012

Re: Changing location of swap directory for selected files, how to?

On Wed, Sep 12, 2012 at 7:54 PM, Karthick Gururaj
<karthick.gururaj@gmail.com> wrote:
> On Wed, Sep 12, 2012 at 7:42 PM, sc <toothpik@swbell.net> wrote:
>> On Wed, Sep 12, 2012 at 06:52:39PM +0530, Karthick Gururaj wrote:
>>> Hello,
>>
>>> I would like to modify the value of 'dir' option for a few specific
>>> files (e.g: all files in directory ~/Foo/). Had 'dir' been a buffer
>>> local option, it would have been a easy thing,
>>> au BufEnter ~/Foo/* set dir=newval
>>
>>> But 'dir' is global across buffers. Can anyone suggest workarounds?
>>
>> you might consider setting the 'directory' option to a real directory,
>> then your swapfiles won't pollute the same path of the files you're
>> editing, and also buys you the advantage of being able to query that
>> path before a new edit session to see what if anything is already being
>> edited
>>
>> you mentioned obtaining default behavior -- the default for 'directory'
>> is to have real paths and all swapfiles in one place
>>
> Sorry I wasn't clear.
>
> The "default" behavior I was referring to was to let,
> set dir=.
> I.e., swap files in the same location as the file being edited.
>
> So to rephrase my query, I would like to set,
> set dir=~/tmp
> for all files in ~/DropBox, and,
> set dir=.
> for all other files.
> Any thoughts on how this can be done? Using BufEnter/BufLeave event
> triggers don't work, as noted in the OP.

Ben, Marcin: thanks for trying to work this out so far. My requirement
is that I do need to create new files in DropBox folder and swap files
do not get created (even temporarily) in that folder. From the
discussions here, I think the only solution is to:
set dir=~/tmp//

This is acceptable solution for me, I'll go ahead with that now.

--
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: