OmniscioGuidesClaude Code Shift+Enter
Shift+Enter sends the message: how to get a newline in Claude Code
In Claude Code, Enter sends the message. Two other keystrokes always add a line, and Shift+Enter adds one in most terminals but not all, which is why the same key works in one terminal and sends early in the next.
This page is about getting a line break into the prompt. The keyboard shortcuts guide lists every key Claude Code answers to, and the message queue guide covers what happens when you send while Claude is still working. Here: the three keys that add a line, which terminals send Shift+Enter, and the settings that make the rest of them behave.
Sources read November 25, 2026. By the Omniscio team. Updated .
The three ways to add a line
Pressing Enter submits your message. To add a line break without submitting, Anthropic documents two keystrokes that work everywhere: press Ctrl+J, or type a backslash and then press Enter. Neither needs any setup, in any terminal.
Ctrl+J add a line break
\ then Enter add a line breakIn most terminals you can also press Shift+Enter, in Anthropic's own wording, but support varies by terminal emulator, and that is the one that varies. Whether it inserts a newline depends on whether your terminal can tell Claude Code that a modified Enter arrived rather than a plain one.
What each key does inside Claude Code
The keybindings reference names the two chat actions behind all of this. chat:submit is bound to Enter by default and submits the message; chat:newline is bound to Ctrl+J and inserts a newline without submitting.
So a prompt that spans several lines is not a special mode. It is a draft you kept adding to, and it goes out the moment you press Enter.
Which terminals send Shift+Enter
Anthropic's table puts terminals in four rows: two that work with no setup, one that needs a single command run once, and one that cannot send Shift+Enter at all. The second of those carries a version floor, v2.1.269 or later.
| Terminal | Shift+Enter for a newline |
|---|---|
| Ghostty, Kitty, iTerm2, WezTerm, Warp, Windows Terminal 1.25 or later | Works without setup |
| Other terminals that support the kitty keyboard protocol, such as foot and Alacritty 0.16 or later | Works without setup; needs Claude Code v2.1.269 or later |
| VS Code, Cursor, Devin Desktop, Alacritty before 0.16, Zed | Run /terminal-setup once |
| gnome-terminal, Windows Terminal before 1.25, JetBrains IDEs such as PyCharm and Android Studio | Not available; use Ctrl+J or \ then Enter |
The last row is the one worth knowing before you go looking for a setting: those terminals have nothing to turn on, and Anthropic's own answer is the keystroke that always works. The keyboard shortcuts guide covers what every other key does.
In the VS Code family the fix is a keybinding written into the editor's terminal configuration, which Anthropic documents as a command rather than a preference you switch by hand.
Run /terminal-setup once
For VS Code, Cursor, Devin Desktop, Alacritty before 0.16 and Zed, /terminal-setup writes a Shift+Enter keybinding into the terminal's configuration file. Run it inside a Claude Code session in that terminal.
The first run confirms with a line such as Installed VSCode terminal Shift+Enter key binding. A later run says the binding is already configured and changes nothing, and existing bindings are left in place rather than replaced.
Run it directly in the host terminal, not inside tmux or screen, because it needs to write the host terminal's configuration. For tmux itself, see the next section.
What it changes besides the keybinding
- In VS Code, Cursor and Devin Desktop it sets
terminal.integrated.gpuAccelerationto"off", which Anthropic says is to prevent garbled text in the integrated terminal. - In the same three editors it sets
terminal.integrated.mouseWheelScrollSensitivityfor smoother scrolling in fullscreen mode. - To undo the acceleration change, set that setting back to
"auto"and reload the editor window.
In Zed, it edits your keymap
A Zed keymap is a file you may already have edited, so Claude Code is careful with it. When the keymap holds bindings and none of them is a Terminal shift-enter, it first backs the file up to a copy in the same directory, then merges the binding in and keeps your other bindings and comments.
If it cannot read, parse, back up or verify the merged result, it leaves the file unchanged and prints the keybinding block for you to add yourself. The same happens when the keymap is a symlink.
Inside tmux
When Claude Code runs inside tmux, Shift+Enter submits by default instead of inserting a newline, and desktop notifications do not reach the outer terminal. Anthropic gives one four-line block that covers both, though each problem keeps only some of it.
set -g allow-passthrough on
set -g focus-events on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'Apply them with tmux source-file ~/.tmux.conf. For Shift+Enter, keep the last two lines, then detach from tmux, attach again and restart Claude Code. To send notifications from a visible pane to Ghostty, Kitty or iTerm2, keep the allow-passthrough line and restart Claude Code; a pane in a window you are not viewing sends none.
So a terminal that sends Shift+Enter correctly on its own can still submit inside a pane, and the tmux lines are the difference. The tmux guide covers running several sessions in panes once the keys arrive.
Option+Enter on a Mac
Some Claude Code shortcuts use the Option key, including Option+Enter for a newline and Option+P to switch models. On macOS, most terminals do not send Option as a modifier by default, so those shortcuts do nothing until you enable it.
The setting is usually labelled "Use Option as Meta Key" in the terminal's preferences. Meta is the historical Unix name for the key now sold as Option or Alt.
- Apple Terminal: Settings, Profiles, Keyboard, then check "Use Option as Meta Key".
- iTerm2: Settings, Profiles, Keys, General, then set both the Left and Right Option key to "Esc+".
- VS Code: add
"terminal.integrated.macOptionIsMeta": trueto your settings.
For Apple Terminal the page adds a detail: /terminal-setup and the first-run setup prompt set this only on macOS 26 and earlier, and both also turn off the profile's audible bell, except in screen reader mode, where /terminal-setup leaves the bell unchanged so it stays audible. For Ghostty, Kitty and other terminals, look for an Option-as-Alt or Option-as-Meta setting in the terminal's own configuration file.
Binding newline to a different key
Anthropic documents one instruction that covers two changes: map the chat:newline and chat:submit actions in your keybindings file. Binding newline to a different key is the first; swapping the behaviour so Enter inserts a newline and Shift+Enter submits is the second.
The swap is for a terminal that does send Shift+Enter and you would rather have it the other way round. A terminal that cannot send it at all has nothing to swap, which is why Ctrl+J is the answer there.
The file is an object with a bindings array, and each block names a context and the keystrokes bound in it. This example binds Ctrl+E to open an external editor and unbinds Ctrl+S; the shape is the same for a newline binding.
Anthropic's Chat actions table is where the action names and their default keys live, so copy a key name from there rather than guessing at its spelling.
{
"$schema": "https://www.schemastore.org/claude-code-keybindings.json",
"bindings": [
{
"context": "Chat",
"bindings": {
"ctrl+e": "chat:externalEditor",
"ctrl+s": null
}
}
]
}Changes to the keybindings file are detected and applied without restarting Claude Code, so you can try a binding and press the key in the same session.
For a message that goes out earlier than you meant because Claude was still working, the message queue guide covers queuing it instead.
Sources
Every line on this page rests on one of these. The date beside each one is the day we read it.
- Configure your terminal for Claude Code, for the newline keys, the per-terminal table, what
/terminal-setupwrites and how to undo it, the tmux configuration, the rebinding advice and the Option-as-Meta settings. Read November 25, 2026. - Customize keyboard shortcuts, for the
chat:newlineandchat:submitactions, the file format and the no-restart behaviour. Read November 25, 2026.
Terminal support moves with both Claude Code and the terminal emulator. The kitty-protocol row already carries a version floor, so re-read the table before you trust a copy of this page from a few months back.
Common questions
Why does Shift+Enter send my message instead of adding a line?
Enter submits your message, and Shift+Enter only adds a line break where the terminal sends it as a modified Enter. Ghostty, Kitty, iTerm2, WezTerm, Warp and Windows Terminal 1.25 or later do that with no setup, as do other terminals using the kitty keyboard protocol on Claude Code v2.1.269 or later; VS Code, Cursor, Devin Desktop, Zed and Alacritty before 0.16 need /terminal-setup run once; gnome-terminal, older Windows Terminal and JetBrains IDEs cannot send it at all.
What is the key for a newline in Claude Code that always works?
Ctrl+J, or typing a backslash and then pressing Enter. Anthropic says both work in every terminal with no setup, so they are the fallback when Shift+Enter submits instead.
What does /terminal-setup change?
In VS Code, Cursor, Devin Desktop, Alacritty before 0.16 and Zed it writes a Shift+Enter keybinding into the terminal's own configuration file. In VS Code, Cursor and Devin Desktop it also sets terminal.integrated.gpuAcceleration to off and changes the mouse wheel scroll sensitivity.
Why does Shift+Enter still submit inside tmux?
Inside tmux, Shift+Enter submits by default. Anthropic gives a four-line block for ~/.tmux.conf; Shift+Enter keeps the last two lines, set -s extended-keys on and the xterm extkeys terminal feature line, then you detach, attach again and restart Claude Code.
Can I make Enter add a newline instead?
Yes. Anthropic documents mapping the chat:newline and chat:submit actions in your keybindings file, which swaps what Enter and Shift+Enter do. Changes to that file are applied without restarting Claude Code.
Every session, one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi and Hermes are all supported.