codex icon indicating copy to clipboard operation
codex copied to clipboard

feat: open prompt in configured external editor

Open sayan-oai opened this issue 2 weeks ago • 13 comments

Add ctrl+g shortcut to enable opening current prompt in configured editor ($VISUAL or $EDITOR).

  • Prompt is updated with editor's content upon editor close.
  • Paste placeholders are automatically expanded when opening the external editor, and are not "recompressed" on close
    • They could be preserved in the editor, but it would be hard to prevent the user from modifying the placeholder text directly, which would drop the mapping to the pending_paste value
  • Image placeholders stay as-is
  • ctrl+g explanation added to shortcuts menu, snapshot tests updated

https://github.com/user-attachments/assets/4ee05c81-fa49-4e99-8b07-fc9eef0bbfce

sayan-oai avatar Dec 04 '25 20:12 sayan-oai

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Dec 04 '25 20:12 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

sayan-oai avatar Dec 04 '25 20:12 sayan-oai

@codex review this

sayan-oai avatar Dec 04 '25 20:12 sayan-oai

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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 (cargo clippy) errors to fix.

etraut-openai avatar Dec 04 '25 21:12 etraut-openai

@codex review this

sayan-oai avatar Dec 05 '25 19:12 sayan-oai

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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. Now, it can open default notepad on windows. Then how do i bring up my implementation in my topic branch so that you can check for the potential integration option into your solution if you like? BTW: i have implemented it as a modular .JS extension along with an extension host on Rust TUI side.

hasan-ozdemir avatar Dec 06 '25 22:12 hasan-ozdemir

@codex review this

sayan-oai avatar Dec 09 '25 16:12 sayan-oai

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@codex review this

sayan-oai avatar Dec 10 '25 08:12 sayan-oai

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@codex review this

sayan-oai avatar Dec 17 '25 01:12 sayan-oai

@codex review this

sayan-oai avatar Dec 19 '25 05:12 sayan-oai

@nornagon-openai Thanks, I appreciate your detailed reviews.

for non-terminal editors (e.g. code --wait), it would be nice to be able to cancel waiting for the editor to quit, in case it got stuck somehow. I'm not totally sure if this is possible to do given we're pausing the terminal event stream, but maybe we could still watch for ^C or something?

The two approaches that come to mind initially both have problems:

  1. Spawn another process that listens for Ctrl+C on stdin (or its equivalent in raw mode since we keep that on), and wait until editor closes OR we read Ctrl+C from stdin.
    • But, I think this would steal keystrokes from terminal editors (vim, nano) as they also read stdin
  2. Handle SIGINT
    • This would require us to leave raw mode, which would reintroduce the need for cursor gymnastics to clear potential input typed while the external editor is open.

Happy to consider other alternatives, and I will get opinions from others internally.

sayan-oai avatar Dec 20 '25 02:12 sayan-oai