A.J.Mechelynck wrote:
Tom Carr wrote:
Let's say I have the following mapping:
nnoremap = 3l
Now if I type =, it moves 3 characters to the right, as expected.
Now if I type 1=, it moves 13 characters to the right instead of 3.
Now if I type 3=, it moves 33 characters to the right instead of 9.
It works correctly just as expected fpo your example. What
do you mean by properly ? Do you mean, use
counter '3' if no counter ig given, otherwise
use the given counter ? Or you mean, move by count*3 ?
Yes, it should move count*3. If there's no count specified it should
move 3, as I explained in the examples.
I don't think there is a proviso to access a previous number from a
Normal-mode mapping (as opposed to a user-command). Mapping = to 3l
means that Vim "replaces" = by 3l when you type it: if you type 3=, the
= is "replaced" by 3l and the result is 33l. That's as documented. If
you were to map = to lll instead, 3= would result in 3lll and move the
cursor by 5 (i.e. count+2) characters.
If you would accept using a user-command, then you could for instance
define
command -nargs=0 -count=1 -bar L call MoveByThrees(<count>)
function MoveByThrees(count)
let i = a:count
while i > 0
normal 3l
i = i - 1
Oops! let i = i - 1
endwhile
endfunction
Then :L<Enter> would give you 3l and :3L<Enter> or :L 3<Enter> would
give you 3l3l3l
Best regards,
Tony.