feat: Ctrl+G external editor for input + /keys command - #4774
Open
iRonin wants to merge 2 commits into
Open
Conversation
iRonin
force-pushed
the
feat/external-editor-input
branch
3 times, most recently
from
April 4, 2026 22:00
4b39220 to
fa243b6
Compare
Adds two features to the Hermes CLI: Ctrl+G — External Editor: - Opens current input in $VISUAL / $EDITOR / VS Code / Cursor / vi - Smart paste detection: if input contains a collapsed paste reference [Pasted text #N → path], opens that file directly for editing - Uses run_in_terminal() for clean TUI suspend/resume - Updates input buffer and paste line count on editor close /keys (/shortcuts) — Keyboard Shortcuts Display: - Categorized list of all keybindings (Input, Session, Drafting, Voice) - Reads voice key from config for accurate display - Registered in CommandDef with tab completion
Input starting with / is only routed to the command handler when the
first word matches a known command (via resolve_command). Bare paths
like /Users/ironin/file.md:45-46 now pass through as regular input
to the agent instead of triggering 'Unknown command'.
Fixes both the process_loop routing and the handle_enter interrupt
bypass — both had the same startswith('/') assumption.
iRonin
force-pushed
the
feat/external-editor-input
branch
from
April 11, 2026 18:50
fa243b6 to
fea6f8d
Compare
This was referenced Apr 28, 2026
Collaborator
Collaborator
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the quality-of-life proposal. The Ctrl+G portion has since landed through merged PR #15821: current main implements the editor handoff at cli.py:5988 and binds it at cli.py:13599.
Problems
cli.py:4915calls_show_keyboard_shortcuts(), but that method is absent from the PR head, so/keyswould fail at runtime.- The PR head does not add the claimed
CommandDef("keys", ...)registration inhermes_cli/commands.py; the central registry drives command help, autocomplete, and platform consumers.
Suggested changes
- Salvage the still-missing
/keysfeature as a focused change: add the display helper, register/keyswith/shortcutsas its alias, and add command/output tests. - Leave the Ctrl+G implementation on current main rather than reintroducing a separate editor path.
This is an automated hermes-sweeper review.
| return False | ||
| elif canonical == "help": | ||
| self.show_help() | ||
| elif canonical in ("keys", "shortcuts"): |
Contributor
There was a problem hiding this comment.
_show_keyboard_shortcuts is not defined anywhere in this PR head, so /keys reaches this branch and raises AttributeError. Please add the helper and a focused command test.
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.
feat: Ctrl+G external editor for input + /keys command
Two quality-of-life features for the Hermes CLI.
Ctrl+G — External Editor
Press Ctrl+G to open your current input in an external editor. Edit freely with full editor capabilities, save, close — the content flows back into the Hermes input.
Smart paste detection: If the input contains a collapsed paste reference (
[Pasted text #1: 42 lines → ~/.hermes/pastes/paste_1_083045.txt]), Ctrl+G opens that paste file directly instead of creating a new temp file. The paste reference's line count updates automatically after editing.Editor resolution:
$VISUAL→$EDITOR→code --wait→cursor --wait→viThis matches Claude Code's Ctrl+G behavior — essential for composing long, structured prompts that are painful to edit in a single-line input area.
/keys (/shortcuts) — Keyboard Shortcuts Display
Type
/keysor/shortcutsto see all available keyboard shortcuts, organized by category:Reads the voice record key from config for accurate display.
Changes
cli.py_show_keyboard_shortcuts()method,/keyscommand routinghermes_cli/commands.pyCommandDef("keys", ...)with/shortcutsaliasThis PR also includes the Ctrl+S stash feature from #4771 (cherry-picked) so both features work together.