Thursday, October 20, 2011

Re: Expression maps and "normal"

Am 19.10.2011 04:21, schrieb David Fishburn:
> On 1/29/2009 7:34 AM, Andy Wokula wrote:
>> ....
>>
>> omap w w<SID>copyreg
>>
>> " if the following is repeated with "." (e.g. "df_.") the expression
>> " will not be evaluated again:
>> ono<expr><script> f "f".<sid>Getchar(). "<SID>copyreg"
>> ono<expr><script> F "F".<sid>Getchar(). "<SID>copyreg"
>>
>> " (should work as well:)
>> " omap<expr> f "f".<sid>Getchar(). "<SID>copyreg"
>>
>> map . .<SID>copyreg
>>
>> nnoremap<silent> <SID>copyreg :call<sid>Record()<cr>
>> inoremap<silent> <SID>copyreg<C-R>=<sid>Record()<cr>
>>
>>
> Andy,
>
> You recommended the following code (which I have been using) some time ago.
>
> I find i am in a situation where I need to pass parameters to <sid>Record().
>
> So expression mapping code does the following:
>
> nnoremap <silent> <SID>yrrecord :call YRRecord3()<cr>
> inoremap <silent> <SID>yrrecord <C-R>=YRRecord3()<cr>
>
> function! YRMapsExpression(sid, motion, ...)
>
> Here is an existing map:
> o y YRMapsExpression("<SNR>107_", "y")
>
> The end of the YRMapsExpreesion function appends the call to the
> let cmds .= a:sid. "yrrecord"
>
> What I would like to do is the following, though I am not certain of
> the syntax given this setup.
>
> Basically, I want the following:
> nnoremap <silent> <SID>yrrecord :call YRRecord3( myMotionParameter )<cr>
> inoremap <silent> <SID>yrrecord <C-R>=YRRecord3( myMotionParameter )<cr>
>
> function! YRMapsExpression(sid, motion, ...)
>
> Here is an existing map with the motion at the end:
> o y YRMapsExpression("<SNR>107_", "y")
>
> The end of the YRMapsExpreesion function appends the call to the
> let cmds .= a:sid. "yrrecord" "y"
>
> So, in the end call YRRecord3("y")
>
> Is this possible using the setup above with the expressions?
>
> Thanks,
> Dave

Hi Dave!

You want mappings with parametrized left-hand-side (?) -- there is no
such thing in Vim.

Could you say more about the purpose of the additional parameter?

--
Andy

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