Claude Code new line: Shift+Enter, Ctrl+J and /terminal-setup
Add a line break in Claude Code without sending: Ctrl+J or \ then Enter, which terminals do Shift+Enter, what /terminal-setup changes, and tmux.
Enter sends the prompt. To start a new line instead, press Ctrl+J, or type \ and then press Enter: Anthropic documents both as working in every terminal with no setup. Shift+Enter works out of the box in Ghostty, Kitty, iTerm2, WezTerm, Warp and Windows Terminal 1.25 or later; in VS Code, Cursor, Zed and older Alacritty, run /terminal-setup once; in gnome-terminal and JetBrains IDEs it is not available. Inside tmux, Shift+Enter sends the prompt until you turn on tmux’s extended-keys. On a Mac, Option+Enter also works once the terminal treats Option as Meta.
The keys that always work
Ctrl+Jinserts a line break. It is the default key for thechat:newlineaction, and Anthropic says it works in any terminal without configuration. It is a plain control character (a line feed), so it also passes through SSH and tmux untouched; that last part is how terminals work, not something Anthropic states.\then Enter does the same: a backslash at the end of the line turns the next Enter into a line break.Ctrl+G(orCtrl+X Ctrl+E) opens the prompt in your default text editor, which is the easier way to write a long, structured prompt.
In Vim editor mode, Enter still sends from INSERT mode; use o or O in NORMAL mode, or Ctrl+J.
Shift+Enter, terminal by terminal
Shift+Enter only works if the terminal sends something different from plain Enter, and not all of them do. As of November 2026, Anthropic’s terminal page sorts them like this:
- Works with no setup: Ghostty, Kitty, iTerm2, WezTerm, Warp, Windows Terminal 1.25 or later; also other terminals with the kitty keyboard protocol, such as foot and Alacritty 0.16 or later, on Claude Code 2.1.269 or later.
- Run
/terminal-setuponce: VS Code, Cursor, Devin Desktop, Zed, Alacritty before 0.16. - Not available: gnome-terminal, Windows Terminal before 1.25, JetBrains IDEs such as PyCharm and Android Studio. Use
Ctrl+Jor\then Enter there.
Apple’s Terminal.app is not in the Shift+Enter table; on a Mac the documented route there is Option+Enter, below.
What /terminal-setup changes
/terminal-setup edits your terminal’s own configuration, so run it in a terminal window on the machine you are sitting at, not inside tmux or screen. What it does depends on the terminal:
- VS Code, Cursor, Devin Desktop: adds a Shift+Enter keybinding (you see “Installed VSCode terminal Shift+Enter key binding”, or “…already configured” if one exists, which it leaves alone). It also sets
terminal.integrated.gpuAccelerationto"off"to stop garbled text, and a smoother mouse-wheel scroll sensitivity. To undo the first, set it back to"auto"and reload the window. - Zed: merges a Shift+Enter binding into
keymap.json, after backing the file up beside itself. If it cannot parse, back up or verify the file, or the keymap is a symlink, it leaves it unchanged and prints the block for you to add. - Alacritty before 0.16: writes the Shift+Enter binding into its configuration file.
- Apple Terminal: turns on “Use Option as Meta Key”, only on macOS 26 and earlier, and turns off the profile’s audible bell (except in screen reader mode).
- iTerm2: Shift+Enter already works; the command turns on “Applications in terminal may access clipboard” so
/copycan reach your clipboard. Restart iTerm2 afterwards.
Option+Enter on a Mac
Option+Enter inserts a new line once the terminal sends Option as a modifier, which most Mac terminals do not by default:
- Terminal.app: Settings, Profiles, Keyboard, tick “Use Option as Meta Key”.
- iTerm2: Settings, Profiles, Keys, General, set Left and Right Option key to “Esc+”.
- VS Code: add
"terminal.integrated.macOptionIsMeta": trueto settings.
Inside tmux
Inside tmux, Shift+Enter sends the prompt by default, even when the terminal around it supports Shift+Enter: tmux’s manual says that with extended-keys off “only standard keys are reported”. Anthropic gives these two lines for ~/.tmux.conf on the machine where tmux runs:
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'CopiedThen run tmux source-file ~/.tmux.conf, detach, attach again and restart Claude Code. The outer terminal still has to be one where Shift+Enter works on its own. Anthropic’s full tmux snippet adds allow-passthrough and focus-events for notifications, covered in the notifications guide. If you are new to tmux, start with what tmux is and why it keeps a session alive.
Anthropic does not document Shift+Enter inside GNU screen. There, and anywhere you are unsure, use Ctrl+J.
Over SSH
Anthropic’s pages do not cover SSH on its own. What follows is inference from how terminals work: keys are encoded by the terminal on the device you type on, and SSH carries those bytes through unchanged, so Shift+Enter on a server should behave as it does locally in that terminal. Running /terminal-setup on the server cannot help, since the configuration it edits lives on your own machine. If the server session runs inside tmux, as it usually should when you run Claude Code on a VPS, the tmux settings above go in the server’s ~/.tmux.conf. From a phone SSH app, whose Shift+Enter handling varies, \ then Enter is the dependable choice (more in using Claude Code from your phone).
Pasting multi-line text
Pasting keeps the line breaks and does not send the prompt. A paste of more than 800 characters or more than three lines collapses to a placeholder such as [Pasted text #1 +120 lines]; the full text is still sent when you press Enter. For whole files or long logs, Anthropic suggests saving them to a file and asking Claude to read it, and says the VS Code integrated terminal can drop characters from very large pastes.
Changing the keys
To use another key for a new line, or to make Enter insert a line and Shift+Enter send, map the chat:newline and chat:submit actions in ~/.claude/keybindings.json (/keybindings opens it; changes apply without a restart). The keybindings reference lists the actions. A swapped Shift+Enter still depends on the terminal sending it, so the table above applies either way.