Skip to content

Fix Claude Code multiline input over SSH ​

SSH carries the bytes emitted by the local terminal. If the local terminal or editor maps Shift+Enter to the same carriage return as Enter, Claude Code receives a submit action instead of a newline. Fix the layer that emits the key sequence, then restart the affected terminal or Claude Code session.

Fast fallback ​

  • Press Ctrl+J to insert a newline.
  • Type a backslash and press Enter to insert a newline.

Both work without terminal setup according to the official terminal configuration guide checked on 2026-11-30.

Use the supported setup ​

Run /terminal-setup directly in the host terminal. Do not run it inside tmux or screen because it writes the host terminal configuration. The official guide lists these cases:

EnvironmentShift+Enter
Ghostty, Kitty, iTerm2, WezTerm, Warp, Windows Terminal 1.25+Works without setup
foot and Alacritty 0.16+ with Claude Code 2.1.269+Works with kitty keyboard protocol support
VS Code, Cursor, Devin Desktop, Zed, older AlacrittyRun /terminal-setup
gnome-terminal, JetBrains terminals, older Windows TerminalUse Ctrl+J or backslash plus Enter

VS Code Remote SSH ​

Edit the local VS Code user keybindings file, not the remote machine. If the local terminal still sends carriage return, map Shift+Enter to the kitty keyboard protocol sequence:

json
[
  {
    "key": "shift+enter",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "\\u001b[13;2u" },
    "when": "terminalFocus"
  }
]

Restart VS Code and reconnect the SSH session after changing the binding.

tmux ​

Add the terminal extension settings to the remote user’s ~/.tmux.conf:

tmux
set -g allow-passthrough on
set -g focus-events on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'

Apply the file with tmux source-file ~/.tmux.conf, detach and attach again, then restart Claude Code. Keep the last two lines for Shift+Enter support.

Acceptance check ​

  1. Open Claude Code through the same SSH and tmux path used in daily work.
  2. Enter two lines with Ctrl+J and verify the message is submitted once.
  3. Test Shift+Enter after the terminal-specific setup.
  4. Keep the fallback when a terminal does not support the kitty keyboard protocol.

This page records terminal behavior and recovery paths. It does not claim that Claude Code itself receives a distinct Shift+Enter event on every SSH stack.

Built for frontend engineers · Powered by VitePress