On 30/08/2018 20:37, Christian Brabandt wrote:
On Do, 30 Aug 2018, John Passaro wrote:
Could you implement the function and accompanying mapping as follows?
imap <expr> <cr> MyFunction("cr")
imap <expr> <Leader>n MyFunction("Leader-n")
This is the typical workaround. The idea was to be able to know in the
function which mapping triggered the call to it, without having special
arguments (which look like they contain redundant information).
Christian, John,
thanks for your replies. Yes, that's what I am currently doing in my
plugin, and it's a very flexible solution, since the argument of
MyFunction does not have to be equal to the lhs.
I was just curious whether one could replace it with
imap <cr> <plug>(MyPlug)
where <plug>(MyPlug) maps to some function. In this case, you cannot
pass arguments, so I was wondering whether one could access the lhs of
the mapping through the plug (presumably, via some special variable).
I couldn't find any way, but I wanted to make sure I wasn't missing
anything from the documentation.
To be clear, this is not a feature request: the "typical workaround", as
I've said, is just fine.
Thanks again,
Life.
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.