feat: add initial support for multi-stroke chord keybindings in emacs mode#989
feat: add initial support for multi-stroke chord keybindings in emacs mode#989reubeno wants to merge 4 commits into
Conversation
|
Thanks for taking the time to put this up. I added a comment to your nushell commit above. I think the code seems plausible but I'm not a big fan of the configuration aspect of it. |
|
Nice foundation. A couple of things #1016 already handles that this is missing: Up for coordinating? |
Adds basic support for adding multi-stroke (chord) keybindings, e.g.:
Changes to public API:
(Breaking change) Remove the existing
pubfield ofKeybindingsso we can unify the implementation between single-keystroke bindings and multi-keystroke bindings.I did some searching on GitHub and couldn't immediately find specific cases that would be broken by this -- but of course, that doesn't prove it won't break a client. (Most of the search hits that came up seemed to be vendored/forked copies of
reedlineornushell, or similar field names in different types.)Adds
Keybindings::add_sequence_binding()andKeybindings::remove_sequence_binding()to bind (or unbind) a sequence of 1 or moreKeyCombinations to aReedlineEvent; this supports both single-keystroke bindings and multi-keystroke chord-style bindings.Retains
Keybinding::add_binding()andKeybinding::remove_binding()for backwards compatibility, replacing their bodies with simple wrapping calls to the new sequence-enlightened calls.General approach:
emacsmode first; do not worry about aligning with existing multi-keystroke processing already present in vi mode for handling commands.I'm looking for feedback on the general approach as well as the implementation before getting any deeper into this. For reference, I've demonstrated how this support could be used in
nushellvia this commit in mynushellfork. There's also a new example included in this draft PR to demonstrate and test.(Aside: This is my first feature-level contribution. I'm eager to get as much feedback as I can!)