feat: Configurable TUI keybindings via config.yaml#8297
Open
yimeng wants to merge 1 commit intoNousResearch:mainfrom
Open
feat: Configurable TUI keybindings via config.yaml#8297yimeng wants to merge 1 commit intoNousResearch:mainfrom
yimeng wants to merge 1 commit intoNousResearch:mainfrom
Conversation
0891cbb to
e4a206d
Compare
Add support for customizing keyboard shortcuts in the interactive CLI
through the config.yaml file. This allows users to:
- Disable or rebind the exit key (Ctrl+D by default is now disabled
to preserve macOS delete-char behavior)
- Customize suspend (Ctrl+Z), newline (Ctrl+J), and alt_newline
(Alt+Enter) bindings
- Set any keybinding to null to disable it
Configuration format in config.yaml:
keybindings:
exit: null # Disable exit keybinding
# exit: ctrl+d # Enable Ctrl+D to exit
suspend: ctrl+z # Suspend to background
newline: ctrl+j # Insert newline
alt_newline: escape+enter
Key features:
- Keys support ctrl+x, alt+x, c-x, a-x formats (case-insensitive)
- Multi-key sequences like escape+enter are supported
- Defaults are set for all bindings except exit (disabled by default)
- Backward compatible: existing configs work without changes
e4a206d to
ebfdef2
Compare
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.
Summary
This PR adds support for customizing keyboard shortcuts in the interactive CLI through the
config.yamlfile. This addresses the common issue where Ctrl+D conflicts with macOS terminalbehavior (forward delete character).
Changes
New Configuration Section
Added
keybindingssection toDEFAULT_CONFIGinhermes_cli/config.py:Keybinding Format
ctrl+x,alt+x,c-x,a-xformats (case-insensitive)escape+enterare supportednullor empty string to disable itModified Bindings
The following bindings are now configurable:
exitnull(disabled)suspendctrl+znewlinectrl+jalt_newlineescape+enterImplementation Details
_normalize_key()and_get_keybinding()incli.pynullto preserve macOS delete-char behaviorTesting
Test default behavior (exit disabled):
Ctrl+D should perform forward delete (macOS default) or EOF (other terminals).
Test enabling Ctrl+D exit:
Ctrl+D should exit Hermes.
Test custom exit key:
Related Issues
This PR addresses the common user request to disable or rebind Ctrl+D to avoid
conflicts with terminal emulators on macOS.