Monday, September 17, 2012

Re: autochdir vs command-t

On Mon, September 17, 2012 08:40, shawn wilson wrote:
> On Mon, Sep 17, 2012 at 1:46 AM, Tony Mechelynck
> <antoine.mechelynck@gmail.com> wrote:
>> On 16/09/12 22:46, shawn wilson wrote:
>>>
>>> On Sun, Sep 16, 2012 at 6:38 PM, Tony Mechelynck
>>> <antoine.mechelynck@gmail.com> wrote:
>>>>
>>>> On 16/09/12 20:08, shawn wilson wrote:
>>>>>
>>>>>
>>>>> i like autochdir so that i can easily rename files and :E stuff where
>>>>> i am. but, then if i use command-t again, it is limited to the
>>>>> current
>>>>> directory. how do i make the pwd of certain commands the path vim was
>>>>> opened in and the pwd of another set of commands the pwd of the file
>>>>> of the current buffer?
>>>>>
>>>>
>>>> What about not using 'autochdir' but
>>>>
>>>> :lcd %:h
>>>>
>>>
>>> that's not a bad solution. is there a way of getting the directory
>>> where i opened vim back? so, basically some way of toggling between
>>> the path of the file and the path i opened vim in? i could map it to
>>> an f-key and be fine with that...
>>>
>>
>
>> either (F5 to toggle)
>>
>> let <SID>curdir = getcwd()
>> map <F5> :if getcwd() == <SID>curdir <Bar> lcd %:h <Bar> else
>> <Bar>
>> exe 'lcd' <SID>curdir <Bar> endif<CR>
>>
>
> thanks for that. though, for some reason, it is erroring:
>
> Error detected while processing /home/swilson/.vimrc:
> line 74:
> E475: Invalid argument: <SID>curdir = getcwd()
> Press ENTER or type command to continue
>
> while i found this
> (http://vimdoc.sourceforge.net/htmldoc/map.html#<SID>) i was unable to
> figure out what the issue is.

Replace the <SID> by g:

regards,
Christian

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