Skip to content

Instantly share code, notes, and snippets.

@PabloLION
Last active October 9, 2025 05:09
Show Gist options
  • Select an option

  • Save PabloLION/f8e81d474b39d500d31307d3195e9ba3 to your computer and use it in GitHub Desktop.

Select an option

Save PabloLION/f8e81d474b39d500d31307d3195e9ba3 to your computer and use it in GitHub Desktop.
Fixing Shift+Enter newline in VS Code terminal (Claude Code)

Fixing Shift+Enter newline in VS Code terminal (Claude Code)

While exploring Claude Code’s /terminal-setup command (found via a /sta fuzzy search in v1.0.111), I noticed the default Shift+Enter binding for terminal input inserts an unwanted backslash before the newline.

Claude Code currently drops its keybinding into the standard VS Code profile (for example, ~/Library/Application Support/Code/User/keybindings.json on macOS). I spend most of my time in VS Code Insiders, so I copied the entry into ~/Library/Application Support/Code - Insiders/User/keybindings.json to make the shortcut available there, too.

Problematic binding

{
  "key": "shift+enter",
  "command": "workbench.action.terminal.sendSequence",
  "args": { "text": "\\\r\n" },
  "when": "terminalFocus"
}

The stray backslash appears because the JSON string escapes the newline sequence, and sending \r/\n directly causes the terminal to execute the line immediately.

Fixed binding (uses bracketed paste mode)

{
  "key": "shift+enter",
  "command": "workbench.action.terminal.sendSequence",
  "args": { "text": "\u001b[200~\n\u001b[201~" },
  "when": "terminalFocus"
}

Wrapping the newline between \u001b[200~ and \u001b[201~ toggles bracketed paste mode, so Shift+Enter now inserts a visible newline without submitting the command — matching the editor and Claude Code REPL behavior.

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