Skip to content

Instantly share code, notes, and snippets.

@daxmc99
Last active September 9, 2026 16:56
Show Gist options
  • Select an option

  • Save daxmc99/e1d947d2df2a26eb64e8a5bc6b28997d to your computer and use it in GitHub Desktop.

Select an option

Save daxmc99/e1d947d2df2a26eb64e8a5bc6b28997d to your computer and use it in GitHub Desktop.
Shift+Enter for newlines in Claude Code on Windows Terminal

Shift+Enter newlines in Claude Code on Windows Terminal

Claude Code inserts a newline when it receives ESC + CR. /terminal-setup installs this for iTerm2 and VS Code, not for Windows Terminal. Add it by hand.

Config

In settings.json, which ctrl+shift+, opens:

"actions": [
    { "command": { "action": "sendInput", "input": "\u001b\r" }, "id": "User.newline" }
],
"keybindings": [
    { "id": "User.newline", "keys": "shift+enter" }
]

Both halves are required, and the two ids must match.

Why it fails silently

Recent Windows Terminal versions split bindings in two. actions defines behavior and tags it with an id. keybindings maps keys to that id. Built-in ids begin with Terminal.; ids beginning with User. you define yourself.

Name an id in keybindings that no actions entry defines, and Windows Terminal resolves the binding to nothing. Shift+Enter falls through to plain Enter. Nothing warns you.

Verify the bytes

stty raw -echo; timeout 5 cat -v; stty sane; echo

Press Shift+Enter, then Enter, then Ctrl+J.

Output for Shift+Enter Meaning
^[^M works
^M no ESC sent
nothing the terminal swallowed the key

Enter prints ^M. Ctrl+J breaks the line, because cat -v leaves LF alone.

stty raw is essential. Canonical mode translates CR to LF before cat reads it, so a newline appears whether or not the ESC arrived.

Run the capture inside your multiplexer, then again in a bare SSH shell. Matching output clears the multiplexer and points upstream.

Dead ends

Kitty CSI-u does nothing. Claude Code never requests the kitty keyboard protocol; it parses only capability responses. Send ESC + CR.

Multiplexers forward ESC + CR. One that swallowed ESC would break Vim.

The hint may still read ctrl+j. Only /terminal-setup sets that flag, and it skips Windows Terminal. The binding works regardless.

Backslash then Enter needs no config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment