Skip to content

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

Open
iRonin wants to merge 3 commits intoNousResearch:mainfrom
iRonin:feat/external-editor-input
Open

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

Conversation

@iRonin
Copy link
Copy Markdown
Contributor

@iRonin iRonin commented Apr 3, 2026

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 from 14a7f25 to 2bfefde Compare April 3, 2026 19:44
iRonin added 3 commits April 4, 2026 15:12
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
…icators

Adds a Claude Code-style input stash to the Hermes CLI:

- Ctrl+S stashes current input (text + attached images) and clears the field
- Ctrl+S on empty input pops the stash back
- Stashed input auto-restores after the agent finishes responding
- Placeholder shows stash preview when idle, hint when agent is running
- Status bar shows a pinned indicator when a stash is active
- Uses (text, [images]) tuple so dragged/pasted images are preserved

Alternative to NousResearch#4259 with additional features: auto-restore after
response (the key UX from Claude Code), image stashing, placeholder
preview, status bar indicator, and proper buf.reset() cleanup.

Closes NousResearch#4255
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 2bfefde to 4b39220 Compare April 4, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant