shift+enter should be newline

Resolved 💬 6 comments Opened May 15, 2026 by vladtsap Closed May 15, 2026
💡 Likely answer: A maintainer (fcoury-oai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.130.0

What subscription do you have?

plus

Which model were you using?

_No response_

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

Codex doctor report

What issue are you seeing?

shift+enter is sending message, should be just a newline

What steps can reproduce the bug?

Uploaded thread: 019e2c79-b3e7-70e0-921a-100bed082d80

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

6 Comments

fcoury-oai contributor · 2 months ago

Could you run codex and tell me what happens when you start /keymap debug and presses Shift+Enter?

darlingm contributor · 2 months ago

It is. /keymap with defaults should show (v0.130.0):

Editor Insert Newline ctrl-j, ctrl-m, enter, shift-enter, alt-enter

The trouble is in a lot of terminal situations, a program doesn't necessarily receive what was pressed. When tmux or ssh are involved, it can get even more complicated. If you're on Linux, you can run /keymap debug in codex or showkey -a in the terminal and it will show you what it's receiving. The terminal I use (st/suckless terminal) sends 0x0d (carriage return) for enter, shift-enter, ctrl-enter, and ctrl-m. So the only defaults that come through for me as a newline signal to Codex CLI are ctrl-j and alt-enter. There's some ways to fight this and terminal behavior varies, but I haven't looked into all that. If you're on Mac or Windows, I have no idea how this goes.

---

What I like is:

[tui.keymap.composer]
submit = "alt-s"

[tui.keymap.editor]
insert_newline = "enter"

That just makes enter be a newline, and you have to press alt-s to send. I hate accidentally sending. This also frees up the other keys, as there's no need for the alternatives.

darlingm contributor · 2 months ago

Related #20555 and #20898.

fcoury-oai contributor · 2 months ago

Did you type /keymap debug

<img width="718" height="334" alt="Image" src="https://github.com/user-attachments/assets/c11d1a75-869e-4a82-93d2-f598252b16e0" />

and pressed enter?

You should see this:

<img width="1376" height="849" alt="Image" src="https://github.com/user-attachments/assets/e6734cbc-43d0-4f98-8f58-f4ad0f6231fe" />

And then when you press Shift+Enter it will show what the terminal is receiving. In my case, when I press Shift+Enter it does receive it:

<img width="1376" height="849" alt="Image" src="https://github.com/user-attachments/assets/1f1b21c0-5f10-44d9-9ea5-7d912331e1a3" />

If you can send me what yours give you, that would help us diagnose it. It's also helpful if you let us know which terminal and operating system you're using.

fcoury-oai contributor · 2 months ago

The issues with Shift+Enter and Zed _may_ be fixed by this PR on next version v0.131.0:

https://github.com/openai/codex/pull/21943

vladtsap · 2 months ago

Yeah, I see the issue, thanks @fcoury-oai @darlingm!

It's actually something on my end (I'm using that via SSH), because I see Shift+Enter as enter only (using /keymap debug or showkey -a). Will try to fix that.

And thanks for hints, I Option/Alt + Enter set a newline for me, will use as a workaround for now.
Thanks again!