Feature: Allow using own editor when writing prompt

Status Closed — not planned
Maintainer reply ✓ Yes — bcherny
Activity 15 comments · opened Mar 3, 2025 · closed Jan 9, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

I think current composer in claude code is already quite superb for a CLI tool, but I'd still prefer to have the option to eg enter /editor, which opens my favorite editor and once I save & exit, to apply it to claude composer.

View original on GitHub ↗

15 Comments

bcherny collaborator · 1 year ago

Cool idea!

anuramat · 1 year ago

found this useful for now (call a script with !, then send an empty prompt)

promptfile=$(mktemp --suffix=.md) && "$YOUR_FAVORITE_TERMINAL" -e "${VISUAL:-EDITOR}" "$promptfile" 2>/dev/null && cat "$promptfile"
sangaline · 1 year ago

In addition to /editor, it would be nice if ctrl-x ctrl-e launched an editor with the current line content as it does in bash. This would allow revising previous prompts from the history or dropping into an editor after you've already entered a lot of text and realize that you need a real editor to continue. Editing significant amounts of text in the input box is very difficult right now, especially because of the inconsistent support for new lines.

jeremyh · 1 year ago

For context: ctrl-x ctrl-e comes from the readline library (which bash uses), so works in many cli apps that use readline.

Some apps have extra slash commands to make it discoverable for users: eg. psql has \e

The standard behaviour is for it to to open the editor specified by $EDITOR with a temp file containing the current prompt, and on exit the contents will be placed in claude's own box, ready to be submitted.

I see a lot of people manually copy/pasting from their editor, so this would be a welcome improvement.

ANogin · 1 year ago

In VSCode integration mode, would of course be very helpful to be able to use VSCode native editor.

maxim-uvarov · 11 months ago

Even though I built my workflow around creating and updating tasks in markdown files, mainly focusing on @todo/task.md mentions, I occasionally need to interact with Claude Code in chat mode to make adjustments.

Very often, those prompts become really long, so I need to edit them in an external editor. ~~However, copying my own text from the input field of Claude Code is painful, as it is rendered with | borders and needs mouse movements or advanced terminal copying exercises.~~ thanks for removing the borders!

Please consider prioritizing this task higher—you will ease the pain for many users!

maxim-uvarov · 10 months ago

Hurray! ctrl + g has arrived!

!Image

Thank you!!!

myarcana · 10 months ago

Why did they use ctrl-g instead of ctrl-x ctrl-e ?

markushav · 10 months ago

How do I get back from the editor? Now I have a good prompt written in editor but mu Claude Code is white? 😛

maddada · 10 months ago

Really useful feature! Thank you.
I always kept hitting snags with the default editor that comes with Claude Code. Still sometimes lose my prompt text due to hitting up/down arrow near the top/end. No redo hotkey. Pasting text truncates it so you can't edit it. Home/End often doesn't work. Shift + Enter has a bug where it doesn't work in VS Code/Cursor terminal in some cases.

How do I get back from the editor? Now I have a good prompt written in editor but mu Claude Code is white? 😛

In case someone else is wondering. Just save and close the editor/tab and you'll be back in Claude Code with the prompt you wrote.

Other tips:

I found that setting the following makes editing prompts much better than using the built in editor or vim (just not for me)

Instructions for macOS and Linux (similar can be done on windows just ask Gemini to give you the equivalent commands)

・ Install Microsoft Edit (a new simple mouse compatible terminal editor): brew install msedit

・ Set the default editor for the terminal. On mac you can add the following to your bash or zsh config:

# Preferred editor for local and remote sessions 
if [[ -n $SSH_CONNECTION ]]; then 
    export EDITOR='edit' 
else 
    export EDITOR='edit' 
fi

Now just hit ctrl + g to edit more involved prompt in a nicer editor (MS Edit) then hit ctrl + q to go back to Claude with your prompt.

You need to paste images into Claude input still. And you don't get completion when you're typing in the editor.
You can mention files by copying the file's full path from cursor and adding @ before it.

Edit: using ″cursor --wait″ as editor is even better than MS Edit since it gives you access to all the AI features (tab completion, Cmd+k, etc.)

vmvartiainen · 9 months ago

How can I use PHPStorm as an external prompt editor? I'm using PHPStorm and running Claude Code in its terminal. It would be great if I could open the prompt for editing directly within the IDE.

maddada · 9 months ago

@vmvartiainen Follow the instructions here to launch a file using phpstorm in the terminal:
https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html

Once you do that, you just need to modify your ~/.zshrc (on macOS) or powershell config on windows to set the default editor

See this post for how to make Cursor your default editor, it has instructions for setting default editor on windows/linux too: https://www.reddit.com/r/ClaudeAI/comments/1okloon/pro_tip_use_ctrlg_to_edit_longer_claude_code/

All you need to do is replace "cursor --wait" with "phpstorm.app --wait" (phpstorm.app might be not the right keyword, see the doc above)

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.