How do I use variables in vim command syntax?

I want to write a function that can map a key to another function.

But I was unable to insert variables into the command map

:

map a:key :! a:action

(which a:key

may be <F9>

, <C-F9>

etc.)

How do I achieve this in vim command statements?

+3


source to share


1 answer


If I understand your question correctly, you are looking for execute

.

:execute "map " . a:key . " :!" . a:action

      



For details see :help :execute

.

+5


source







All Articles