helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.9k stars 2.51k forks source link

insufficient repeat #3869

Open txtyash opened 2 years ago

txtyash commented 2 years ago

The current repeat only repeat's last insertion. Alt-. repeat's last motion. This leaves out sequences like wd, ms(, etc.

Adding these under . probably doesn't do any damage. Since, a lot of vim users use plugins like vim-repeat which repeat last surround under the same .(period) key. It pollutes last repeat but fine really.

Or if polluting repeats is a problem then a picker for repeats would solve this problem and helix wouldn't need Alt-.

youngmit commented 2 years ago

I've been trying to transition to hx from nvim lately, and this is one of my biggest pain points right now. would like to do some movement and an insertion and be able to repeat the whole thing with .

something like miwc some_text and be able to apply the same to other words easily.

archseer commented 2 years ago

miwc some_text

That will repeat just fine with Alt-. ..

txtyash commented 2 years ago

@archseer That is not a very good repeat IMO.

If helix strictly wants to keep "match" repeats different from other repeats then I'd suggest putting repeat under "match" mode:

I do not know why delete actions cannot be repeated with .. Is repeating delete actions a bad idea?

the-mikedavis commented 2 years ago

. repeats the last insert.

If you're repeating a lot, you are most likely not taking advantage the indended usage of multiple selections.

If the entire action of miwd could be repeated, it would break select-then-act: you couldn't see what you were deleting before you deleted it.

sicher commented 1 year ago

Would it make sense to add a command and binding for "repeat_last_command"?

A use case could be: say you want to perform "extend_line_above" or "kill_to_line_end" a few times and don't have a custom binding setup. Then you may bring up the command palette, find the command, hit enter, and then repeat the command as many times you'd like with a keystroke.

soloturn commented 1 year ago

currently i am using the workaround to (1) search string (2) record a macro (3) press anything necessary and stop recording, then repat as often as necessary: (4) search again and (5) replay the macro: /<search-text> ENTER Q <do whatever i want> ESC Q n q n q

johnnyutahh commented 1 year ago

fyi. Related discussion (over the past day) found here: https://github.com/helix-editor/helix/discussions/8311

also fyi: I'm told (in above discussion) the hx . code is found here (as of 2023-09-17, anyway): https://github.com/helix-editor/helix/blob/master/helix-term/src/ui/editor.rs#L895-L929