Support macro-style keybindings - #4709
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
The issue of static commands being executed immediately while macros are executed by the compositor afterwards doesn't seem to be resolved? "D" = ["find_till_char", "@<ret>", "delete_selection"]the expected behaviour upon pressing |
|
Ah nice catch, thanks for the good example! That's a tricky case. It's partially related to #4013. We may want to support macro keybinds initially by disallowing them in sequences: supporting macro keybinds is straightforward if we ignore sequences. I'll push a change to fix that case (and #4013) but I feel like it might be a bit hacky: I'm adding a fake Event for the compositor to handle so that it can handle sequences that use callbacks in the correct order. |
|
There's also #4244 |
|
So the expected behaviour is happening now, good 👍. However, one small bug I've found: take the |
f212bfe to
52dba16
Compare
It looks like #4244 has a similar concept for pending commands. It fixes the problem for on-next-key callbacks but not the compositor callbacks used by macros (
Whoops, forgot to clear the pseudo-pending 😅. Should be fixed in the latest |
86300ac to
de58e63
Compare
|
Maybe this isn't easily doable but wouldn't it be nicer if instead of [keys.normal]
D = "@t<ret>d"
W = "@miw"you could write [keys.normal]
D = ["@find_next_char <ret>", "delete_selection"]
W = "@select_textobject_inner w"(or with some symbol other than |
|
That style is also possible with this branch: [keys.normal]
D = ["find_till_char", "@<ret>", "delete_selection"]
W = ["select_textobject_inner", "@w"] |
|
Do you still want to get this merged? I saw you marked it as draft. |
|
There's a regression for long lists of regular commands where we don't re-render after executing the commands. The changes around that are a bit hacky anyway so I need to think about how to do this nicely (and without regressions) |
90f0779 to
d277696
Compare
This is a temporary limitation because of the way that command sequences are executed. Each command is currently executed back-to-back synchronously, but macros are by design queued up for the compositor. So macros mixed into a command sequence will behave undesirably: they will be executed after the rest of the static and/or typable commands in the sequence. This is pending a larger refactor of how we handle commands. <https://redirect.github.com/helix-editor/helix/issues/5555> has further details and <https://redirect.github.com/helix-editor/helix/issues/4508> discusses a similar problem faced by the command palette.
d277696 to
05905e8
Compare
Running into this now. Any chance of a follow-up PR to get macro keybinds working in sequences? |
|
could we get a new release for this feature? 🙏 |
|
yeah the hope is to cut a new release either later this month or in early January as time allows |
|
@llakala I made an issue for tracking: #12420 - Support macros in keybinding sequences |
Macro key-sequences can be used to implement custom keybinds for commands that require some sort of input like
tormi:To implement them, we parse a sequence of KeyEvents the same way that we parse macro input, then execute them by setting up a callback which passes the KeyEvents through the compositor.
Closes #1383