-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: open prompt in configured external editor #7606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
@codex review this |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@sayan-oai, looks like there are a few lint ( |
| tracing::warn!("failed to restore terminal modes before editor: {err}"); | ||
| } | ||
|
|
||
| let editor_result = editor::run_editor(&seed, &editor_cmd).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this look like if EDITOR="code --wait"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this, it opens a window as expected, and the text propagates back to the composer on save+close.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the terminal window look like while the editor is running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks "the same" (just as if you tabbed away from the terminal, so the cursor isn't blinking).
if you tab back into the terminal while the code window is open and add text to the prompt, that text is retained (the resulting text from the code window is prepended to the text you added). but this seems like an edge case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm... but didn't we disable all our terminal modes? we shouldn't be running the TUI at the same time as the editor is open, I think.
e.g. what happens if you end up in an odd state, e.g. an approval dialog is showing, or you're in transcript mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also consider what happens if you open a terminal editor like vim while a turn is running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should behave roughly the same as ^Z.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an approval dialog is showing
yeah, you can still open + use the editor while an approval dialog is showing, and the results will persist to the prompt editor, but you won't see that until you dismiss the dialog. I think we could easily block opening the external editor while a dialog is displayed.
or you're in transcript mode
the Ctrl+G shortcut is gated on there not being an overlay active, so you cannot open the external editor if transcript mode or another overlay is open.
what happens if you open a terminal editor like vim while a turn is running
this is allowed, and we block on the terminal editor closing, so new events (like SSE updates) are accumulated but not processed in the main loop. Once you exit the terminal editor, they're processed and the TUI updates.
If we switched to the Ctrl+Z approach, we wouldn't be able to open the external editor mid-turn, which could disappoint users who expect to be able to write their next prompt while inference runs for the previous one. FWIW, Claude Code allows launching the external editor while a turn is in progress.
I think we could go either way. Thoughts?
|
@codex review this |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Dear Participants; i have also implemented "ctrl+e:edit prompt in external editor" feature on windows since i was not aware of the improvement on this issue yet. |
Add
ctrl+gshortcut to enable opening current prompt in configured editor ($VISUALor$EDITOR).pending_pastevaluectrl+gexplanation added to shortcuts menu, snapshot tests updatedScreen.Recording.2025-12-04.at.12.41.42.PM.mov