On 17/09/12 09:57, Christian Brabandt wrote:
> On Mon, September 17, 2012 08:40, shawn wilson wrote:
>> On Mon, Sep 17, 2012 at 1:46 AM, Tony Mechelynck
[...]
>>> 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
>
That's what I had thought of at first, but then I thought it would cause
problems if any plugin were using the same variable name.
Can't you define script-local variables in such a way that they be
usable in mappings defined in that same script, the way you can with
functions?
Oh, after rereading ":help <SID>": use s: in :let but <SID> in the
mapping? Or define the mapping to call a function and use the s:
variable inside the function?
Best regards,
Tony.
--
Have an adequate day.
--
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
Monday, September 17, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment