I have created a vmap
but I can't figure out how to apply a count to it.
In this case, the mapping is on <C-a>
and 4<C-a>
is an example of a command with a count failing to be applied. We would expect the <C-a>
command to be called four times in the second case.
I use the following modified version of <C-a>
for incrementing numbers:
vnoremap <C-a> $<ESC>`>v`<<C-a>gvo
This version has the benefit that you can visually select a vertical list of numbers and repeatedly increment them using repeated invocations of <C-v>
, without having to reselect, and without having to worry about expanding your selection to capture numbers that have "rolled over" to add another digit.
There are various tutorials online for getting a count to apply to a mapping. I have been unsuccessful in getting them to work for this command.
Keywords: <C-a>
ctrl-a
ctrl+a
:h v:count
and maybe this question which might be a duplicate. – statox♦ Aug 18 '17 at 7:17