Am 20.10.2011 22:33, schrieb David Fishburn:
On 10/20/2011 3:50 AM, Andy Wokula wrote:
Am 19.10.2011 04:21, schrieb David Fishburn:
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?
So basically we have a omap (expression map) on y which call YRMapsExpression:
o y YRMapsExpression("<SNR>107_", "y")
When I hit yy, YRMapsExpression is called, and it tacks on the call to:
nnoremap <silent> <SID>yrrecord :call YRRecord3( myMotionParameter )<cr>
let cmds .= a:sid. "yrrecord"
return cmds
So, when this executes, it also executes the call to YRRecord3().
Other expression maps are created as well:
ye
yw
yb
...
Basically, in YRRecord3(), I want to know that "ye" was called. Right
now, I have no idea what mapping triggered the call to this function.
I could simply create a script variable and in YRMapsExpression do this:
let s:yr_last_motion = 'ye'
You probably mean :let s:yr_last_motion = 'e'.
Then in YRRecord3(), I have a reference to it.
What I was worried about in this approach is the nesting of cmds and
mappings, and the issue of what happens when I run macros.
I wasn't sure I would have a proper stack of calls when only using a
script variable.
YRMapsExpression() sets the variable, YRRecord3() reads the variable.
YRMapsExpression() (with {motion} being mapped to it) is an indirection
for {motion}<SID>yrrecord, and <SID>yrrecord calls YRRecord3().
I don't see how this could involve nesting.
--
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