juliapath / evil-numbers

Increment and decrement numbers in Emacs
GNU General Public License v3.0
39 stars 6 forks source link

Rectangle region increments by line number #28

Closed milesfrain closed 3 years ago

milesfrain commented 3 years ago

@ideasman42 originally described this issue https://github.com/cofi/evil-numbers/issues/7, but it's still not working correctly on this fork. Instead of incrementing every number by 1, it increments each by the line number of the selection.

For example, starting with:

1 a
2 b
3 c
0 d
0 e

Then selecting the first column (normal mode cursor over 1, Ctrl-v, jjjj), and incrementing (Ctrl-a, or g= in doom emacs), results in:

2 a
4 b
6 c
4 d
5 e

I'd expect this to behave the same as vim and produce:

2 a
3 b
4 c
1 d
1 e
ideasman42 commented 3 years ago

It looks like you're using inc-at-pt-incremental instead of evil-numbers/inc-at-pt which behaves as you expect.

Can you confirm this?

milesfrain commented 3 years ago

Indeed. Thanks for the troubleshooting help. Looks like I needed g+, not g=.

      :n  "g="    #'evil-numbers/inc-at-pt
      :n  "g-"    #'evil-numbers/dec-at-pt
      :v  "g="    #'evil-numbers/inc-at-pt-incremental
      :v  "g-"    #'evil-numbers/dec-at-pt-incremental
      :v  "g+"    #'evil-numbers/inc-at-pt

https://github.com/hlissner/doom-emacs/blob/6678f3833b5c237b8bf4a0a65449244bec5554e5/modules/editor/evil/config.el#L479-L483