Revamp keybinding mechanism to support richer keybindings (e.g. ctrl-alt-shift-x )#5563
Merged
Conversation
An uppercase letter is not valid with ctrl, and only works because we lowercase the string before parsing it. This will change later in this branch when we start supporting bindings like <c-s-r>.
So that it is next to KeyFromLabel.
Move keybindings.GetKey to config.GetValidatedKeyBindingKey
This changes not only how we store modifiers (inside of Key instead of passing it separately), but also how we parse keybinding strings: it supports all combinations of modifiers now (if the terminal supports it, that is).
The previous version only enumerated the supported (non-rune) bindings. Replace it with a description of the syntax: how to spell single-rune keys, special keys, and modified keys; how to combine modifiers; the keyword forms for `<space>`, `<minus>`, `<plus>`; and which combinations are rejected because terminals can't deliver them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
These are the same as many editors (e.g. VS Code) use for moving a line up/down, so they are easy to remember.
This was referenced Apr 30, 2026
stefanhaller
added a commit
that referenced
this pull request
May 6, 2026
Followup to #5563; I forgot to do this there.
ctrl-alt-shift-x )
This file contains hidden or 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
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.
Revamp lazygit's keybinding mechanism to support richer keybindings for those terminals that support the newer keyboard protocols. This makes it possible to use keybindings such as
ctrl-alt-shift-x.Change the default keybindings for moving commits up and down from
ctrl-k/ctrl-jtoalt-up/alt-down; this is mostly for personal preference, I find them easier to remember, and they are nicely similar to moving a line of code up and down in many code editors. Also, change the default binding for submitting a commit from the commit description editor fromalt-entertocommand-enteron Mac, orctrl-enteron Linux and Windows; these are the same bindings that are used in many multi-line edit field situations, e.g. in GitHub comments.See docs/keybindings/Custom_Keybindings.md for caveats about terminal compatibility.