Claude Corner

Long Prompt Cramped in Claude Code's Input Box? Press Ctrl+G and Write It in Your Editor.

By · 27 Oct 2026

Claude Corner illustration for “Long Prompt Cramped in Claude Code's Input Box? Press Ctrl+G and Write It in Your Editor.”

At a glance

  • Ctrl+G moves the prompt you are typing into your own text editor, and saving sends the text back to Claude Code.
  • One /config switch puts Claude's last reply at the top of that file as comments, so you can answer it point by point.
  • The same key works on custom answers to Claude's questions and in agent view, and you can rebind it.

You need to give Claude a real brief: the bug, the three files involved, what you already tried and what done looks like. The input box is fine for one line. For twenty, you are hunting for the newline key, scrolling a cramped box and hoping Enter does not send half a thought. Your editor already handles this well, and Claude Code will hand the prompt to it.

Why it matters

The prompt is the cheapest place to save Claude a wrong turn. A brief with clear steps, pasted error lines and a definition of done costs you two minutes to write and can save a round of fixes. In the input box, long prompts get shortened because editing them is awkward. In your editor you get your own keys, search, undo and spell check, and nothing sends until you save and press Enter. If you reply to a long answer, you can also see that answer while you write.

How to write prompts in your editor

We built these steps from Anthropic's docs and have not run them in a live session.

  1. Tell your shell which editor to use. The docs call it your default text editor, and the agent view docs name $VISUAL or $EDITOR. Set one in your shell profile, then restart Claude Code.
  2. Start typing your prompt, then press Ctrl+G. Ctrl+X Ctrl+E, the readline-style binding, does the same thing. Whatever you already typed comes along, and editors that take a line number open on the line your cursor was on.
  3. Write the full brief, save and close the editor. The text returns to the input box. Read it once and press Enter.
  4. Reply to Claude with its answer in view. Run /config and turn on Show last response in external editor. The file then opens with up to the last 50 lines of Claude's reply as # comment lines above a marker, and only what you write below the marker is sent.
  5. Use it beyond the main prompt. The docs say the key also edits a custom response, such as your own answer when Claude asks a question, and it opens the dispatch prompt in agent view.
  6. Rebind it if Ctrl+G is taken. Run /keybindings to open ~/.claude/keybindings.json, and map a key to chat:externalEditor in the Chat context.
export VISUAL=vim                 # shell profile: pick your editor
Ctrl+G                            # prompt opens in that editor
Ctrl+X Ctrl+E                     # same, readline style
/config                           # Show last response in external editor
{ "externalEditorContext": true } # same switch, in ~/.claude.json
/keybindings                      # rebind chat:externalEditor

Gotchas

  • The setting lives in the global file. externalEditorContext belongs in ~/.claude.json. Claude Code ignores it in settings.json, so a copy there does nothing.
  • Agent view only takes the single key. In agent view the Ctrl+X Ctrl+E chord does not open the editor. Use Ctrl+G, or a single key you bound to chat:externalEditor.
  • Short edits do not need it. For a few extra lines, Ctrl+J or a backslash then Enter adds a newline in any terminal, and Shift+Enter works in most. Run /terminal-setup once in VS Code, Cursor or Zed.

Sources:

Recommended AI prompt

Copy this paragraph into ChatGPT, Claude, Gemini, Grok, or whatever AI you use.

Prompt

I use Claude Code in a terminal and my long prompts end up short and messy because the input box is hard to edit. Ask me which text editor I use, which shell and terminal I run, and whether I use agent view. Then tell me exactly what to add to my shell profile so Ctrl+G opens that editor, how to turn on Show last response in external editor, and a short template for a task brief I can fill in each time. Use only behavior described in the official Claude Code docs and link me to the interactive mode page.