Introduction
The terminal input is great for short prompts and works fine for multiline prompts of a few lines. It becomes a pain when you are drafting a 50-line spec, pasting in a long stack trace, or carefully composing a structured request with code blocks. For those moments, Hermes lets you pop the input buffer into your full external editor by pressing Ctrl+G (or Ctrl+X Ctrl+E as an Emacs-style alias). Save and quit, and the edited text becomes your next prompt.
Key Concepts
$EDITOR: The environment variable that selects your editor (vim, nvim, nano, code, etc.).Ctrl+G: Opens the current input buffer in$EDITOR.Ctrl+X Ctrl+E: Emacs-style alias for the same action.- Round-trip: Save and quit returns the buffer to Hermes as the next prompt.
Real World Context
A developer is writing a detailed spec for an API endpoint, with request/response examples, edge cases, and a validation table. They start typing in the terminal, hit two lines, and realize this is a 60-line prompt. They press Ctrl+G. Vim opens with the partial draft. They finish writing in their editor (with syntax highlighting, search, multi-cursor), save and quit. The full prompt lands in Hermes and sends.
Deep Dive
When you press Ctrl+G, Hermes:
- Takes whatever is in your current input buffer (including any partial multi-line text).
- Writes it to a temporary file.
- Launches
$EDITORon that file. - Waits for the editor to exit.
- Reads the file back.
- Loads its contents as your new input.
The round-trip is invisible if your $EDITOR is set sensibly. On most systems:
textexport EDITOR=nvim # or vim, nano, code, helix, ...
Once that is set, Ctrl+G is your portal. You stay in the terminal for short prompts and pop out to the editor for long ones, all without leaving Hermes.
When to drop into $EDITOR
The heuristic that works: when your prompt grows past five or six lines, or when you are pasting in structured content (code, logs, tables), Ctrl+G is the right move. Specifically:
- Long-form requirements: Specs, design notes, multi-section briefs.
- Code excerpts: Pasting in 40 lines of TypeScript for a refactor request.
- Structured templates: Filling in a checklist or template you have memorized.
- Multi-cursor edits: When you want to fix typos in three places, the editor is the right tool.
When to stay in the terminal
For anything short, the editor round-trip is overhead. Use the terminal multiline keystrokes (Alt+Enter, Ctrl+J) for two- to four-line prompts. Reserve Ctrl+G for the moments where you would otherwise be fighting the terminal input.
The Ctrl+X Ctrl+E alias
Ctrl+X Ctrl+E does the same thing as Ctrl+G. The alias exists because long-time bash and Emacs users have Ctrl+X Ctrl+E in their fingers. If Ctrl+G conflicts with something else in your terminal setup, the alias is your fallback.
Common Pitfalls
- Forgetting to set
$EDITOR: If$EDITORis unset, Hermes will fall back to a default that may not be what you want. Set it once in your shell rc file and never think about it again. - Using
Ctrl+Gfor one-line prompts: The editor round-trip costs you 5-10 seconds. For short prompts, that is pure overhead.
Best Practices
- Set
$EDITORdeliberately: Use the same editor you use for code. Familiarity matters more than features here. - Use Ctrl+G the moment a prompt grows past five lines: The break-even point is roughly when terminal-input friction outweighs editor-launch overhead.
Summary
Ctrl+Gopens the input buffer in$EDITOR;Ctrl+X Ctrl+Eis the alias.- The round-trip is invisible: save and quit returns the edited text as your next prompt.
- Set
$EDITORin your shell rc so the experience is familiar. - Use Ctrl+G for long-form prompts; stay in the terminal for short ones.
Code Examples
# One-time setup: pick your editor and persist it
echo 'export EDITOR=nvim' >> ~/.zshrc # or ~/.bashrc, fish equivalent, etc.
# In Hermes, when a prompt is about to get long:
# 1. Type the first line
# 2. Press Ctrl+G
# 3. Finish drafting in nvim with full features (syntax, multi-cursor, search)
# 4. :wq to save and quit
# 5. The full text lands in Hermes as your next prompt