Add shortcut (Esc) to quickly reset current input prompt

Resolved 💬 6 comments Opened Aug 30, 2025 by dpolivaev Closed Sep 1, 2025
💡 Likely answer: A maintainer (guidedways, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

When using codex in interactive mode, if I paste or type a long prompt by mistake, there is currently no way to quickly clear it. The only option is to manually delete the text character by character, which is slow and frustrating, especially with multi-line pasted text.

Proposed solution:
Introduce a shortcut to reset the current input line, similar to Claude Code’s behavior. Pressing Esc should instantly clear the entire prompt buffer and return me to an empty line.

Benefits:

  • Saves time when correcting mistakes.
  • Prevents the need to hold backspace or re-open the session.
  • Matches user expectations from comparable tools.

Alternatives considered:

  • Using Ctrl+U or Ctrl+W (standard readline shortcuts) is not as intuitive or discoverable as Esc.
  • Restarting the cli session is disruptive.

Are you interested in implementing this feature?

I could try.

Additional information

_No response_

View original on GitHub ↗

6 Comments

guidedways contributor · 12 months ago

Escape is easily pressed - there should be a separate or configurable shortcut for this, this could be devastating if one was to write a 20 line prompt and hit escape accidentally.

dpolivaev · 12 months ago

Well, I do not believe in configurations. Codex could ask for confirmation (Delete? Yes/No)

rben01 contributor · 12 months ago

Press escape once to prompt, escape again to confirm the deletion. This is what Claude Code does.

Ctrl-C also would work fine, and would match shells. Not sure why these CLI agents have it set to exit the session when clearly that's the job of Ctrl-D (which also does that)

rhukster · 12 months ago

came here looking for this as a claude code user previously, but I did find esc is easily done accidentally, so i was just curious if there was another codex way. I think i'll just stick with terminal defaults though:

  • Ctrl + U -> delete form cursor to start
  • Ctrl + K -> delete from cursor to end
  • Ctrl + W -> delete from cursor to previous whitespace (word delete)
dpolivaev · 12 months ago

@rhukster Thank you very much for your hint, Ctrl+ U solves it for me.

veighnsche · 6 months ago

I ended up here after a google search
The answer you're probably looking for is:

CTRL + C <- this will clear the input