-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sequenced Keybindings #2121
Merged
Sequenced Keybindings #2121
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is going to let us have a central place we can encode all the inputs up to an invalid binding.
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1420
This adds support for sequenced keybinds. In other programs these are sometimes called key chords, leader sequence, key tables, etc (these are also all slightly different concepts if you really dig into the details, but in the same category). Effectively, they're the ability to specify a keybinding not happen unless a sequence of separate key inputs is given. As examples, these are commonly present in tmux, emacs, etc.
Sequenced key binds use the existing
keybind
configuration, but introduce a new symbol>
as a way to separate the sequenced triggers. For example,ctrl+a>b=text:hello
will write the text "hello" after the users pressesctrl+a
and thenb
. Some behavioral details (in the documentation, too):ctrl+a
and you have any children defined, Ghostty will wait forever for an input.ctrl+a>b
and typectrl+a>c
, then Ghostty will encode and sendctrl+a
followed byc
to the pty.ctrl+a>b
and trigger it, bothctrl+a
andb
are consumed.unconsumed:
feature will apply to the full sequence. If you bindunconsumed:ctrl+a>b
then triggering the sequence will encode and flush bothctrl+a
andb
. There is no way today to only unconsumed a partial sequence.ctrl+a
is bound tonew_window
andctrl+a>n
is bound tonew_tab
, pressingctrl+a
will do nothing.ctrl+a>n
andctrl+a>t
, and then bindctrl+a
directly, bothctrl+a>n
andctrl+a>t
will become unbound.Future Work
+show-keybinds
CLI action silently ignores key sequences. cc @rockorager