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 think it'd be more accurate to say that you _want_ the cursor to move
count*3 spaces to the right; the behavior is correct according to the
documentation.
OK, enough of being pedantic (although it is helpful to read the dox and
understand 'em). May I point out that the following tip,
http://vim.sourceforge.net/tips/tip.php?tip_id=895
helps with solving this problem; in particular, the example on using a
map (\gg), a <count>, a command, and a function. In particular, here's
a solution:
map = :RightShift<cr>
com! -count=1 RightShift call RightShifter(<count>)
fun! RightShifter(cnt)
exe "norm! ".(3*a:cnt)."l"
endfun
The = map invokes a command. The command accepts an optional count
(default=1). Any count preceding the map will get passed along, too.
The command passes the count along to the RightShifter function. The
function does the requested multiply by 3 and does the shift using exe
and norm! .
Regards,
Chip Campbell