Skip to content

feat: support handing off long prompts to external editor via Ctrl+G #7020

@bmizerany

Description

@bmizerany

What feature would you like to see?

Add the ability to hand off the composer to an external text editor
($EDITOR or $VISUAL) for editing long or complex prompts. This
addresses ergonomics issues when prompts grow too large for
comfortable TUI editing.

Motivation

The current TUI composer works well for quick, simple prompts, but
becomes cumbersome when users need to write longer or more complex
instructions. Users may want to:

  • Switch to their preferred text editor for better ergonomics
  • Use their editor's features (search, replace, syntax highlighting,
    macros)
  • Start composing in the TUI and switch to an editor if the prompt
    grows too long
  • Leverage existing editor configuration and muscle memory

This feature exists in Claude Code (using Ctrl+G), and implementing
it in Codex with the same binding would:

  • Reduce friction for users transitioning from Claude Code to Codex
  • Follow established prior art and user expectations

Proposed Solution

Add a Ctrl+G keybinding that:

  1. Hands off the current composer content to $EDITOR (or $VISUAL)
  2. Allows editing in the external editor
  3. Returns the edited draft to the composer on editor exit
  4. Handles cleanup (trimming final newline that editors often add)
  5. Maintains ergonomics if editor config is unavailable

Related

This is a follow-up to #906 (C-x C-e feature request), which was
closed because it targeted the TypeScript implementation. Per the
maintainer's suggestion in that issue, this request is for the
Rust-based CLI implementation.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions