Hello,
What is the counterpart in VimL of perl's map command?
Here's an example of how the map command would be useful
in VimL:
As shown by the example in help inputlist():
let color = inputlist(['Select color:', '1. red',
\ '2. green', '3. blue'])
to effectively use inputlist([textlist]) one needs
to massage the list in two ways: prepend the list
with a message such as "Select color:" and provide
the index of each item in the list.
I know how to do both the "massaging" in perl and for
perl's lists:
perl $i=0;
\ @b = ('Select color:');
\ push @b, map {$i++; "$i. $_"} qw(red green blue);
\ VIM::Msg("@b");
Unless there is a better way, VimL's insert() can be
used to perform the "push" step above.
But how would one do the "map" step above in VimL?
Thanks,
--Suresh