[BUG] Shift+Enter Does Not Insert New Line in WSL on Windows 10

Open 💬 35 comments Opened May 23, 2025 by sap2me

Environment
Platform (select one):

Anthropic API

AWS Bedrock

Google Vertex AI

Other: Claude CLI

Claude CLI version: 1.0.2 (Claude Code)

Operating System: Windows 10 (10.0.19045.3803)

Terminal: Windows Terminal (WSL)

WSL version: 2.4.13.0

Kernel version: 5.15.167.4-1

WSLg version: 1.0.65

Shell: bash

Bug Description
Pressing Shift+Enter inside Claude CLI running in WSL on Windows 10 does not insert a new line. Instead, it behaves the same as pressing Enter, which prematurely submits the current input. This prevents users from writing multiline prompts or code blocks.

Steps to Reproduce
Open Claude CLI (claude) in WSL (bash shell) using Windows Terminal

Start typing a multiline prompt or code

Press Shift+Enter expecting a newline

Input is submitted instead of moving to the next line

Expected Behavior
Shift+Enter should insert a new line, allowing users to write properly formatted multiline input without submitting prematurely.

Actual Behavior
Shift+Enter submits the input, just like Enter, making multiline prompts impossible.

Additional Context
This affects productivity when writing structured prompts or code snippets.
Reproducible consistently on a clean WSL 2 environment with Windows 10.
Would be helpful to support standard multiline input behavior.

View original on GitHub ↗

35 Comments

StephenBadger · 1 year ago

Same issue, very annoying. Makes it hard to talk to Claude. Also loving the extension, thanks team

heat · 1 year ago

@sap2me I'm using their recommendation \ + return in order to add new lines.

related https://github.com/anthropics/claude-code/issues/729

isi2010 · 1 year ago
@sap2me I'm using their recommendation \ + return in order to add new lines. related #729

But this isn’t the solution. In every work you are using shift + enter for a new line and this is for years like this. Really hard to train yourself to use something else for a new line

pupeno · 1 year ago

I tried adding this:

[
    {
        "key": "shift+enter",
        "command": "type",
        "args": {
            "text": "\n"
        },
        "when": "claudeCode.chatInputFocused"
    }
]

to keybindings.json and it made no difference. This is super annoying. I'm wasting so many tokens on half finished prompts. I'm starting to compose prompts on a text file and copy and paste, but it makes the workflow slower.

pupeno · 1 year ago

I think I see what the problem is. Claude Code adds the key binding inside WSL and it needs to be outside. It adds:

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

to /home/pupeno/.config/Code/User/keybindings.json inside the Linux Claude Code is running into, instead to the correct one of the VSCode that is running, which in my case it's C:\Users\pupeno\AppData\Roaming\Code\User\keybindings.json.

gusbicalho · 1 year ago

@pupeno I think that's part of the issue. In my setup, adding that keybinding to the correct keybindings.json file left me with an extra \ when I hit shift+enter:

!Image

The keybinding below works most of the time, but sometimes I am still left with the hanging \:

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

So it looks like Claude Code doe snot handle the \ Enter sequence properly if it's sent too quickly

mathwcst-bitlyft · 1 year ago
@pupeno I think that's part of the issue. In my setup, adding that keybinding to the correct keybindings.json file left me with an extra \ when I hit shift+enter: !Image The keybinding below works most of the time, but sometimes I am still left with the hanging \: [ { "key": "shift+enter", "command": "runCommands", "args": { "commands": [ { "command": "workbench.action.terminal.sendSequence", "args": { "text": "\\" } }, { "command": "workbench.action.terminal.sendSequence", "args": { "text": "\n" } } ] }, "when": "terminalFocus" } ] So it looks like Claude Code doe snot handle the \ Enter sequence properly if it's sent too quickly

You're a freaking SAVIOR!

pupeno · 1 year ago

Yeah, I also get the "\\". I'm just accepting it until the people at Anthropics improve this.

Noir-Lime · 1 year ago
I think I see what the problem is. Claude Code adds the key binding inside WSL and it needs to be outside. It adds: `` [ { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\\\r\n" }, "when": "terminalFocus" } ] ` to /home/pupeno/.config/Code/User/keybindings.json inside the Linux Claude Code is running into, instead to the correct one of the VSCode that is running, which in my case it's C:\Users\pupeno\AppData\Roaming\Code\User\keybindings.json`.

Thanks! this fixed it for me.

dkarelov · 1 year ago

If you are WSL2 user and use Claude Code under Windows Terminal in Windows 11, then you can use CTRL+BACKSPACE (kill word) and SHIFT+ENTER (enter new line) the following way (in Windows Terminal settings, then bottom left Open JSON file, then inside "actions" block add in the beginning):

{"command": {"action": "sendInput", "input": "\n"}, "keys": "shift+enter"},
{"command": {"action": "sendInput", "input": "\^W"}, "keys": "ctrl+backspace"},

Now you can work like a proper human being ;)

thomascgray · 1 year ago

@dkarelov you are a champion 👍 this worked a treat

JuliaBonita · 1 year ago

None of the other solutions worked for me in the VSCode terminal (bash). This is the only approach that worked for me:

// VSC's keybindings.json
// Rule 1: Prevent conflicting commands from running.
    {
        "key": "shift+enter",
        "command": "-workbench.action.terminal.runSelectedText",
        "when": "terminalFocus && !terminalTextSelected"
    },
    // Rule 2: Send the shell's line-continuation syntax.
    {
        "key": "shift+enter",
        "command": "workbench.action.terminal.sendSequence",
        "args": {
            // Send a literal backslash (\\) and a newline (\n).
            "text": "\\\n"
        },
        "when": "terminalFocus"
    }

In WSL2, something completely blocks all attempts to modify the key bindings using bind or any other system tools. I tried many different approaches, but the two JSON objects above are the only thing that worked to create the shift+enter behavior in VSCode's terminal and Claud Code's VSCode plugin terminal.

tsytskanovich · 12 months ago
None of the other solutions worked for me in the VSCode terminal (bash). This is the only approach that worked for me: `` // VSC's keybindings.json // Rule 1: Prevent conflicting commands from running. { "key": "shift+enter", "command": "-workbench.action.terminal.runSelectedText", "when": "terminalFocus && !terminalTextSelected" }, // Rule 2: Send the shell's line-continuation syntax. { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { // Send a literal backslash (\\) and a newline (\n). "text": "\\\n" }, "when": "terminalFocus" } ` In WSL2, something completely blocks all attempts to modify the key bindings using bind or any other system tools. I tried many different approaches, but the two JSON objects above are the only thing that worked to create the shift+enter` behavior in VSCode's terminal and Claud Code's VSCode plugin terminal.

It worked. Thank you!

vitmantug · 11 months ago
None of the other solutions worked for me in the VSCode terminal (bash). This is the only approach that worked for me: `` // VSC's keybindings.json // Rule 1: Prevent conflicting commands from running. { "key": "shift+enter", "command": "-workbench.action.terminal.runSelectedText", "when": "terminalFocus && !terminalTextSelected" }, // Rule 2: Send the shell's line-continuation syntax. { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { // Send a literal backslash (\\) and a newline (\n). "text": "\\\n" }, "when": "terminalFocus" } ` In WSL2, something completely blocks all attempts to modify the key bindings using bind or any other system tools. I tried many different approaches, but the two JSON objects above are the only thing that worked to create the shift+enter` behavior in VSCode's terminal and Claud Code's VSCode plugin terminal.

This has the same problem as the solution that was mentioned here: https://github.com/anthropics/claude-code/issues/1262#issuecomment-2926962304
That will add a backslash at the end of every line.

This is the only solution that works flawlessly (no backslash) on Windows + WSL + VSCode terminal: https://github.com/anthropics/claude-code/issues/2754#issuecomment-3064554102

ben-alkov · 11 months ago
simon-ami · 11 months ago

Related and solution for people on Linux/Ubuntu (I think, at least works for me): https://github.com/anthropics/claude-code/issues/5760#issue-3321991860

rublev · 10 months ago

No fix for MacOS? still getting the backslash -_-

agn-7 · 9 months ago

For MacOS and Cursor IDE, the path of the keybinding is "/Users/benyamin/Library/Application Support/Cursor/User/keybindings.json".

In my case, when I open the Claude Code using Cursor/VSCode extension, the <kbd>Shift</kbd> + <kbd>Enter</kbd> doesn't add a new line. But when I open the Claude Code via terminal or the terminal inside the IDE, it works well.

An alternative solution in this situation in MacOS is using <kbd>Option</kbd> + <kbd>Enter</kbd>

kevin-on · 9 months ago
For MacOS and Cursor IDE, the path of the keybinding is "/Users/benyamin/Library/Application Support/Cursor/User/keybindings.json". In my case, when I open the Claude Code using Cursor/VSCode extension, the Shift + Enter doesn't add a new line. But when I open the Claude Code via terminal or the terminal inside the IDE, it works well. An alternative solution in this situation in MacOS is using Option + Enter

I'm also having exactly the same issue in MacOS.

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

davidvazteixeira · 7 months ago

Same on Linux here (no WSL, Ubuntu 24.04 and gnome-terminal and xfce4-terminal). Alt+Return and "type \" works, but \terminal-setup complains about VTE based.

LeandroCostaSantos · 7 months ago

same problem here

danielasher115 · 6 months ago

For me, on Windows 11 using WSL2 in Cursor or VS Code, adding the following entry to the keybindings.json array fixed the issue:

{
    "key": "shift+enter",
    "command": "workbench.action.terminal.sendSequence",
    "args": {
        "text": "\^[[200~\r\n\^[[201~"
    },
    "when": "terminalFocus && remoteName == 'wsl'"
}

keybindings.json locations:
Cursor: C:\Users\<YOUR_USER>\AppData\Roaming\Cursor\User\keybindings.json
VSCode: C:\Users\<YOUR_USER>\AppData\Roaming\Code\User\keybindings.json

rusty-art · 5 months ago

---

Workaround for Windows Terminal + WSL:

Add this to your Windows Terminal settings.json:

Location: %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json

Or press Ctrl+, in Windows Terminal, then click "Open JSON file" in the bottom left.

Add to the actions array:

"actions": [
    {
        "command": {
            "action": "sendInput",
            "input": "\^[[13;2u"
        },
        "keys": "shift+enter"
    }
],

This sends a CSI u-style escape sequence that Claude Code recognises as Shift+Enter.

---

coreyt · 5 months ago

I have tried the settings.json updates, but none of it worked for me. Instead, I used the Windows 10 console settings gui, and it worked:
Open a console (command, Ubuntu, PowerShell), next to new tab click the downward chevron \/, go into Settings. On the left, go to Actions, Click [Add new] button. Press {Shift+Enter] (together), then in the downward chevron in the row and select "Send Input: "[ESC][13;2u"

<img width="510" height="71" alt="Image" src="https://github.com/user-attachments/assets/16bb44d8-ccf9-4ea7-9ea4-ced7d10baf9b" />

modbender · 5 months ago

I think this can be closed now,
Running /terminal-setup gives mentions the issue and solution
Adding this config into C:/Users/<User>/AppData/Roaming/Code/User/keybindings.json works even on WSL

[
       {
         "key": "shift+enter",
         "command": "workbench.action.terminal.sendSequence",
         "args": { "text": "\^[\r" },
         "when": "terminalFocus"
       }
]
vekien · 4 months ago
I think this can be closed now, Running /terminal-setup gives mentions the issue and solution Adding this config into C:/Users/<User>/AppData/Roaming/Code/User/keybindings.json works even on WSL [ { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\^[\r" }, "when": "terminalFocus" } ]

Did not work for me.

jay-lanterncare · 4 months ago
Workaround for Windows Terminal + WSL: Add this to your Windows Terminal settings.json: Location: %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json Or press Ctrl+, in Windows Terminal, then click "Open JSON file" in the bottom left. Add to the actions array: "actions": [ { "command": { "action": "sendInput", "input": "\^[[13;2u" }, "keys": "shift+enter" } ], This sends a CSI u-style escape sequence that Claude Code recognises as Shift+Enter.

This worked for windows terminal. Thanks @rusty-art

Budgulick · 4 months ago

Workaround: Shift+Enter for newline in Claude Code on Windows Terminal

Verified working on:

  • Windows 11 Pro (10.0.26200)
  • Windows Terminal 1.23.20211.0
  • Claude Code 2.1.70

The root cause is that Windows Terminal sends the same byte (CR) for both Enter and Shift+Enter — the terminal can't distinguish them. The fix requires two changes:

1. Windows Terminal — teach it to send a distinct escape sequence for Shift+Enter

In %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json, add to actions:

{
    "command": {
        "action": "sendInput",
        "input": "\^[[13;2u"
    },
    "id": "User.sendInput.ShiftEnter"
}

And add to keybindings:

{
    "id": "User.sendInput.ShiftEnter",
    "keys": "shift+enter"
}

2. Claude Code — map Shift+Enter to newline

In ~/.claude/keybindings.json:

{
  "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
  "$docs": "https://code.claude.com/docs/en/keybindings",
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "shift+enter": "chat:newline"
      }
    }
  ]
}

Restart Windows Terminal after both changes. Shift+Enter will insert a newline, Enter will send — matching Claude.ai and Claude Desktop behavior.

ethanfischer · 4 months ago

@Budgulick 's fix worked for me! Thank you

6-keem · 4 months ago

Sharing my fix

Situation 1: VSCode terminal + WSL Ubuntu

Edit C:\Users\<YOUR_USER>\AppData\Roaming\Code\User\keybindings.json (Windows path, NOT inside WSL)

Open via Ctrl+Shift+PPreferences: Open Keyboard Shortcuts (JSON)

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

Situation 2: Windows Terminal + WSL Ubuntu

Open Windows Terminal → Ctrl+, → bottom left "Open JSON file" → settings.json

"actions": [
  {
    "command": {
      "action": "sendInput",
      "input": "\^[\r"
    },
    "id": "User.sendInput.ShiftEnter"
  }
],
"keybindings": [
  {
    "id": "User.sendInput.ShiftEnter",
    "keys": "shift+enter"
  }
]
ohxyz · 1 month ago
Sharing my fix Situation 1: VSCode terminal + WSL Ubuntu Edit C:\Users\<YOUR_USER>\AppData\Roaming\Code\User\keybindings.json (Windows path, NOT inside WSL) Open via Ctrl+Shift+PPreferences: Open Keyboard Shortcuts (JSON) [ { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\^[\r" }, "when": "terminalFocus" } ] Situation 2: Windows Terminal + WSL Ubuntu Open Windows Terminal → Ctrl+, → bottom left "Open JSON file" → settings.json "actions": [ { "command": { "action": "sendInput", "input": "\^[\r" }, "id": "User.sendInput.ShiftEnter" } ], "keybindings": [ { "id": "User.sendInput.ShiftEnter", "keys": "shift+enter" } ]

Haven't tried the VS Code one. The Windows Terminal one worked for me. Thanks

vladsterian-diconium · 1 month ago

I confirm that it works on VS Code Insiders. Great. Thank you!!

rjgotten · 8 days ago

Doesn't work properly from flat plain Windows Terminal / Powershell 7 on Windows 11 either.
Don't even have to involve WSL.

cduivis · 8 days ago

Same issue for me on:

  • Windows 11
  • Powershell 7.6

And also no WSL