the maparg()
function is what you are looking for. :h maparg(
to see detail.
to your question, if you have those two mapping, you could:
let a = maparg('a','i')
let b = maparg('b','v')
Pregunta
Let's say I have the next mapping:
imap a AAA
vmap b BBB
I need a way to get value of mappings. The next is not suitable for me, because I need to operate by returned mapped values:
imap a
vmap b
I'm looking for for something like these functions:
let a = getimap("a") => a = "AAA"
let b = getvmap("b") => b = "BBB"
Solución
the maparg()
function is what you are looking for. :h maparg(
to see detail.
to your question, if you have those two mapping, you could:
let a = maparg('a','i')
let b = maparg('b','v')
Otros consejos
You can use maparg()
to do this, like so:
let a = maparg("a")
You can also specify the mode if you only want mappings for one mode, and it will optionally populate a dictionary with every detail of the mapping (things like <silent>
, etc.). See :h maparg()
for all the details.