Thursday, September 29, 2016

Determine key binding used to call a mapping

Is there a way to obtain the mapping used to call a function from within that function (like with "v:operator")?

E.g. to reduce this

map vax :call SFunc(0)
map vix :call SFunc(1)

function SFunc(inner)
if a:inner
...
endif
endfunction

to something like this:

function SFunc()
if <???> == "i" (or "ix")
...
endif
endfunction

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment