Skip to content

feat: Ctrl+G external editor for input + /keys command - #4774

Open
iRonin wants to merge 2 commits into
NousResearch:mainfrom
iRonin:feat/external-editor-input
Open

feat: Ctrl+G external editor for input + /keys command#4774
iRonin wants to merge 2 commits into
NousResearch:mainfrom
iRonin:feat/external-editor-input

Conversation

@iRonin

@iRonin iRonin commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

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$EDITORcode --waitcursor --waitvi

This 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 /keys or /shortcuts to see all available keyboard shortcuts, organized by category:

  • Input — Enter, Alt+Enter, Tab, Up/Down
  • Session — Ctrl+C, Ctrl+D, Ctrl+Z
  • Drafting — Ctrl+G, Ctrl+S, Ctrl+V
  • Voice — configurable push-to-talk key

Reads the voice record key from config for accurate display.

Changes

File What
cli.py Ctrl+G keybinding, _show_keyboard_shortcuts() method, /keys command routing
hermes_cli/commands.py CommandDef("keys", ...) with /shortcuts alias

This PR also includes the Ctrl+S stash feature from #4771 (cherry-picked) so both features work together.

@iRonin
iRonin force-pushed the feat/external-editor-input branch 3 times, most recently from 4b39220 to fa243b6 Compare April 4, 2026 22:00
iRonin added 2 commits April 11, 2026 14:47
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
iRonin force-pushed the feat/external-editor-input branch from fa243b6 to fea6f8d Compare April 11, 2026 18:50
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #5511 — same Ctrl+G external editor + /keys feature request. Also overlaps #11427.

@alt-glitch alt-glitch added the duplicate This issue or pull request already exists label May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #5511 — same Ctrl+G external editor + /keys feature request. Also overlaps #11427.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:4915 calls _show_keyboard_shortcuts(), but that method is absent from the PR head, so /keys would fail at runtime.
  • The PR head does not add the claimed CommandDef("keys", ...) registration in hermes_cli/commands.py; the central registry drives command help, autocomplete, and platform consumers.

Suggested changes

  • Salvage the still-missing /keys feature as a focused change: add the display helper, register /keys with /shortcuts as 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.

Comment thread cli.py
return False
elif canonical == "help":
self.show_help()
elif canonical in ("keys", "shortcuts"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants