helix icon indicating copy to clipboard operation
helix copied to clipboard

feat(commands) increment by range

Open Bruce-Hopkins opened this issue 2 years ago • 11 comments

Increment increases the increment amount by 1 (or negative 1) for each value based on issue #3910.

This completely changes the way increment works, so maybe this is better as another command. I don't know what that would be though.

Bruce-Hopkins avatar Oct 22 '22 10:10 Bruce-Hopkins

I think it'd be better to add this functionality into a seperate command, the default behaviour shouldn't be changed for a normal increment, as there a legitimate usecases for it.

also, once the increment counter hit 10+ the results get scewed heavily.

SoraTenshi avatar Oct 22 '22 12:10 SoraTenshi

also, once the increment counter hit 10+ the results get scewed heavily.

I believe this issue may be corrected by #4123

olafmustafar avatar Oct 22 '22 13:10 olafmustafar

I think it'd be better to add this functionality into a seperate command, the default behaviour shouldn't be changed for a normal increment, as there a legitimate usecases for it.

I agree. I'm trying to figure out which keymap to connect both of them two. Temporarily, I set it to Alt-a. Any suggestions?

I believe this issue may be corrected by https://github.com/helix-editor/helix/pull/4123

I hope I'm not causing bad merge conflicts.

Bruce-Hopkins avatar Oct 22 '22 14:10 Bruce-Hopkins

@CBenoit I've changed the keymappings to be alt+ctrl

is this good to be merged?

Bruce-Hopkins avatar Oct 25 '22 09:10 Bruce-Hopkins

I've changed the keymappings to be alt+ctrl

Is C-A (ctrl + shift) and C-X already reserved / taken? Because i think they'd make more sense...

SoraTenshi avatar Oct 25 '22 10:10 SoraTenshi

Is C-A (ctrl + shift) and C-X already reserved / taken? Because i think they'd make more sense...

I've tried those keymaps but for some reason, they don't work. I'm guessing you can't pair (alt + shift) in the keymaps. Try it out and let me know if it works for you.

Bruce-Hopkins avatar Oct 25 '22 10:10 Bruce-Hopkins

I don't think we implement the # special register from Kakoune yet (https://github.com/mawww/kakoune/blob/master/doc/pages/registers.asciidoc#special-registers) but "#<C-a> and "#<C-x> could be an nice way to do this without needing to add a new command and keybind.

the-mikedavis avatar Oct 28 '22 02:10 the-mikedavis

I don't think we implement the # special register from Kakoune yet (https://github.com/mawww/kakoune/blob/master/doc/pages/registers.asciidoc#special-registers) but "#<C-a> and #<C-x> could be an nice way to do this without needing to add a new command and keybind.

So should we close the PR until the special register is implemented? Or should this just be a temporary fix until then?

Bruce-Hopkins avatar Oct 29 '22 09:10 Bruce-Hopkins

I think it would be ok to kind of hack it in this PR: in increment_impl check the cx.register to see if it's '#' and if it is then increment by range number (multiplied by count?)

the-mikedavis avatar Oct 29 '22 14:10 the-mikedavis

I think it would be ok to kind of hack it in this PR: in increment_impl check the cx.register to see if it's '#' and if it is then increment by range number (multiplied by count?)

Oh, I didn't even know we could see which register we're using. How about this? Does this look good?

Bruce-Hopkins avatar Oct 31 '22 17:10 Bruce-Hopkins

@the-mikedavis How does it look now?

Bruce-Hopkins avatar Nov 03 '22 10:11 Bruce-Hopkins

This is looking good 👍

Just needs a run of cargo fmt

the-mikedavis avatar Nov 08 '22 01:11 the-mikedavis

I just ran the formatter.

Bruce-Hopkins avatar Nov 11 '22 17:11 Bruce-Hopkins