Make ENTER insert newline in Codex TUI input (send on Ctrl+Enter instead)
What variant of Codex are you using?
CLI
What feature would you like to see?
Summary
Currently, the Codex CLI/TUI sends the prompt on ENTER and inserts a newline on Ctrl + J. While this matches traditional terminal behavior, the Codex TUI functions primarily as a multiline prompt editor rather than a classic shell.
This keybinding choice conflicts with modern text-editing conventions and frequently leads to accidental submission of incomplete prompts.
---
Problem
In most contemporary tools (IDEs, chat interfaces, documentation tools, browsers, etc.):
ENTERinserts a newlineCtrl + Entersubmits content (or, alternatively,CMD + Enter)
The Codex TUI reverses this expectation:
ENTERsubmitsCtrl + Jinserts newline
This creates several usability issues:
- Strong mismatch with established typing muscle memory
- Frequent accidental submission of unfinished prompts
- Cognitive friction when switching between Codex and other tools
Ctrl + Jis non-standard and unintuitive for multiline entry
In practice, this results in a high rate of unintended prompt submission.
---
Proposed Change
Adopt a text-editor-oriented interaction model:
ENTER→ Insert newlineCtrl + EnterorCMD + Enter→ Submit prompt
Alternatively, and MUCH BETTER - make this configurable:
- Terminal-style mode (current behavior)
- Editor-style mode (proposed behavior)
- Define custom bindings (let user choose their combinations)
---
Rationale
The Codex TUI operates more like a structured prompt composition interface than a traditional command shell. Aligning keybindings with modern editor conventions would:
- Reduce accidental submissions
- Improve workflow consistency
- Lower cognitive load
- Better match user expectations in AI prompt composition contexts
This change would improve usability without affecting core functionality.
Additional information
_No response_
20 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Neither of them are duplicates of what is requested here.
It would be nice, at least, to have these as configurable settings.
this is how all the CLIs work. I personally prefer it the way it is.
Shift+Enter is the standard on CLI tools for newline, but every terminal does handle it a bit differently.
@am-will shift+enter doesn’t add new line in codex CLI.
The only that does is ctrl+j
I’d be fine with shift+enter!
It's Terminal dependent. What are you using?
Macs Terminal App
+1 much needed
Shift + Enter makes sense for new line??
I researched this a bit and actually, it is just plain implausible in some terminals or possibly in all.
While it _makes sense_ for those of us who do not "come" from a terminal world, a vim nerd would kill us for saying that, because no, new line is ctrl + j and enter is submit and that's it (for them). Well. They also grow beards and like to type typos to correct with
fkbut whatever 🤣Thing is, _preferences aside_, its just impossible sending a shift key modifier to a _terminal_, it is usually hijacked by the app level (similar as cmd on a Mac can never be sent to the terminal, only to the wrapping app).
It might as such simply be impossible to achieve what was asked for here :(
Please make it configurable, for clients that use both ChatGPT and codex, i.e. all your clients, this is extremely frustrating as in ChatGPT we have to press Shift+Enter for a new line and in codex Ctrl+J.
It feels like every 10 minutes I have to stop a run because my prompt was not done yet, I just pressed shift+Enter from muscle memory and in codex world that means ENTER not new line... making me pull my hear out at a product that is otherwise absolutely amazing!
@gertsteyn see my previous comment, its not necessarily "codex world" but rather "terminal world".
For solving the issue on my end I use
ctrl+G, it opens it in your defined code editor, which allows you to write prompt there and then save + close said temp file, which puts it automatically into the prompt area of CLI.That avoids the rather nerdy
ctrl+j.Be that as it may, enter is never newline in any other tui agent so that would be highly disruptive imo.
Every terminal handles newline differently and I sympathize with how annoying that may be, but enter should remain send for sure.
Try control+enter? One of them should work.
I think the common thread here is some mechanism that allows customisation. E.g. like in slack and many other chat based apps where you can choose if submit must be enter or Ctrl+Enter or anything else if the user wanted to.
If some options like Shift is not available because of terminal limitations then so be it, but at least give power users the option to customise with what is available.
After-all someone decided that TAB should be SUBMIT, but Ctrl+Enter must not be allowed??
@am-will
Yes, as you can see that was widely clarified already after your comment, thanks!
On Mac at least, you can't do ctrl + enter either. _Perhaps_ one could mess with system keyboard binding but that is too much of a customization even if possible, just to fix something that can be easily worked around by using
ctrl+G(open editor).I personally feel this ticket could be indeed closed, because it is just not really feasible to do much customizations apparently in a terminal.
Happy thou to leave it open for if the team at OAI is willing to look at options.
@smileBeda The open editor is not a real solution as you then loose other crutial functionality like the @ file auto completion.
FYI: The coding agent from the other side of the aisle already went through this episode and resolved it:
_
_
https://code.claude.com/docs/en/interactive-mode
For sure. I'd love to see more customization for you though. Cheers
A lot of this is possible today through the configurable TUI keymap.
For the “editor-style” behavior where Enter inserts a newline and Ctrl+Enter submits, you can configure:
editor.insert_newlinealready includes plainenterby default, so oncecomposer.submitno longer owns plain Enter, pressing Enter will insert a newline.A fuller explicit version would be:
What this does not provide yet is a first-class preset like
terminal-stylevseditor-style, orCmd+Enteras a portable keymap modifier. So the current answer is “yes via keymap config for Ctrl+Enter,” but not yet as a one-line UX mode.Regarding the Cmd+Enter request, the tricky part is that
Cmdis not something terminal apps generally pass through to terminal programs as a normal, portable modifier the wayCtrl,Alt, orShiftcan be reported.On macOS,
Cmdis usually handled by the terminal emulator or host app itself for window/menu shortcuts. Some terminals can be configured to catch aCmdshortcut and send a custom byte sequence to the shell, but that is terminal-specific configuration rather than something Codex can rely on natively across terminals.Today, the portable Codex-side option is to bind submit to something like
Ctrl+Enter:Then users who want
Cmd+Entercan often configure their terminal to translateCmd+Enterinto whatever sequence their terminal sends forCtrl+Enter, or into another sequence Codex already understands.For example, in terminals such as WezTerm, Ghostty, Alacritty, kitty, iTerm2, or VS Code’s integrated terminal, this is typically possible through a custom keybinding that sends text / an escape sequence to the terminal process. The exact syntax differs by terminal, so we probably should not document one universal
Cmd+Enterbinding as if it works everywhere.So I think the solution here would be:
ctrl-enter,shift-enter,alt-enter, etc.Cmd+Enterat the terminal-emulator layer to one of those portable bindings.Cmd+Entera default Codex binding unless we add and validate first-classcmd/superkeymap support across the major macOS terminals.If this setup covers your workflow, would you mind closing the issue?
I am closing this issue, but if you find it still doesn't work, feel free to leave a comment and I'll reopen it.
@fcoury-oai - sorry for the delayed reply.
Even though things are different in 0.130.0, it’s still basically impossible to map Shift+Enter (or honestly any sane keybinding) in the Mac Terminal.app in a way that makes these features behave correctly and not break other keybindings.
And this isn’t even Codex's fault. It's apparently just a feature limitation of a $2000 machine made by a company whose entire brand is "it just works".
I finally gave up fighting it and installed Ghostty. Zero config. Works immediately.
Really makes you reflect on life choices. But I guess the divorce-inciting software running on beautiful hardware tradeoff is still somehow better than the alternatives.
Jeez. What a deeply committed fanboy idiot I am.
<img width="1254" height="1254" alt="Image" src="https://github.com/user-attachments/assets/64fd70db-aa4f-42ce-aee9-aa2e8302760a" />