Increment decrement number under cursor?

Michael Markert markert.michael at googlemail.com
Sat Aug 27 16:07:20 CEST 2011


On 27 Aug 2011, Antono Vasiljev wrote:

>
>> Because I wanted to improve my own inc/dec function for a while I
>> took the afternoon and went for vim emulation. Except that it keeps
>> the width
>
>> in binary (but that looks like a vim bug).
>>
>> Behold:
>> https://gist.github.com/1161129
>>
>> It's not exactly pretty and there's a function waiting to jump out
>> but according to my tests it works as its vim counterpart does.
>>
>> So please test it and give me feedback :)
>
> One difference i found: it does not increment numbers
> at end of word like vim does:
>
> my<cur>word12
>
> should increment to myword13

Thanks, knowing this I tested that (in vim):

my<cur>word word word12

increments to 

my<cur>word word word13

At least it doesn't try to increment over several lines ;)
My code doesn't do this, but I think it's worthwhile.

And a funny piece:

my<cur>word word word 0b01

increments to 

my<cur>word word word 1b01

vim's support for binary literals sure has some issues.

> Anyway, thank you for your snippet.
> Probably you can share it as evil-incdecr?

As add-on-package you mean? Sure. But as I already pointed out:
Something alike should go into evil.

Before that it sure needs some work:

- I'll drop "support" for negative octal and hex literals as things just
  don't work and won't work since there's no single useful definition
  (I'm not sure what rode my while I implemented that).

- Find a number from point/cursor on before inc/dec

I hope you find more issues!

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : https://lists.ourproject.org/pipermail/implementations-list/attachments/20110827/b0e63d0c/attachment.pgp 


More information about the implementations-list mailing list