Reputation: 4056
I want to write a function that can map a key to another function.
But I failed to insert the variables into map
command:
map a:key :! a:action
(in which a:key
may be <F9>
, <C-F9>
and so on)
How to achieve this in vim command-like sentences?
Upvotes: 3
Views: 1575
Reputation: 40947
If I understand your question correctly, you're looking for execute
.
:execute "map " . a:key . " :!" . a:action
See :help :execute
for more information.
Upvotes: 5