[BUG] Shift+Enter Does Not Insert New Line in WSL on Windows 10
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.
35 Comments
Same issue, very annoying. Makes it hard to talk to Claude. Also loving the extension, thanks team
@sap2me I'm using their recommendation
\ + returnin order to add new lines.related https://github.com/anthropics/claude-code/issues/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
I tried adding this:
to
keybindings.jsonand 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.I think I see what the problem is. Claude Code adds the key binding inside WSL and it needs to be outside. It adds:
to
/home/pupeno/.config/Code/User/keybindings.jsoninside the Linux Claude Code is running into, instead to the correct one of the VSCode that is running, which in my case it'sC:\Users\pupeno\AppData\Roaming\Code\User\keybindings.json.@pupeno I think that's part of the issue. In my setup, adding that keybinding to the correct
keybindings.jsonfile 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
\:So it looks like Claude Code doe snot handle the
\ Entersequence properly if it's sent too quicklyYou're a freaking SAVIOR!
Yeah, I also get the "\\". I'm just accepting it until the people at Anthropics improve this.
Thanks! this fixed it for me.
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 ;)
@dkarelov you are a champion 👍 this worked a treat
None of the other solutions worked for me in the VSCode terminal (bash). This is the only approach that worked for me:
In WSL2, something completely blocks all attempts to modify the key bindings using
bindor any other system tools. I tried many different approaches, but the two JSON objects above are the only thing that worked to create theshift+enterbehavior in VSCode's terminal and Claud Code's VSCode plugin terminal.It worked. Thank you!
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
Fix working for Code on Fedora https://gist.github.com/ben-alkov/1329c25db38cf2ea7ae9ea7fdaf10d3a
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
No fix for MacOS? still getting the backslash -_-
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>
I'm also having exactly the same issue in MacOS.
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.
Same on Linux here (no WSL, Ubuntu 24.04 and gnome-terminal and xfce4-terminal). Alt+Return and "type \" works, but
\terminal-setupcomplains about VTE based.same problem here
For me, on Windows 11 using WSL2 in Cursor or VS Code, adding the following entry to the
keybindings.jsonarray fixed the issue:keybindings.jsonlocations:Cursor:
C:\Users\<YOUR_USER>\AppData\Roaming\Cursor\User\keybindings.jsonVSCode:
C:\Users\<YOUR_USER>\AppData\Roaming\Code\User\keybindings.json---
Workaround for Windows Terminal + WSL:
Add this to your Windows Terminal
settings.json:Location:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.jsonOr press
Ctrl+,in Windows Terminal, then click "Open JSON file" in the bottom left.Add to the
actionsarray:This sends a CSI u-style escape sequence that Claude Code recognises as Shift+Enter.
---
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" />
I think this can be closed now,
Running
/terminal-setupgives mentions the issue and solutionAdding this config into
C:/Users/<User>/AppData/Roaming/Code/User/keybindings.jsonworks even on WSLDid not work for me.
This worked for windows terminal. Thanks @rusty-art
Workaround: Shift+Enter for newline in Claude Code on Windows Terminal
Verified working on:
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 toactions:And add to
keybindings:2. Claude Code — map Shift+Enter to newline
In
~/.claude/keybindings.json:Restart Windows Terminal after both changes. Shift+Enter will insert a newline, Enter will send — matching Claude.ai and Claude Desktop behavior.
@Budgulick 's fix worked for me! Thank you
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+P→Preferences: Open Keyboard Shortcuts (JSON)Situation 2: Windows Terminal + WSL Ubuntu
Open Windows Terminal →
Ctrl+,→ bottom left "Open JSON file" →settings.jsonHaven't tried the VS Code one. The Windows Terminal one worked for me. Thanks
I confirm that it works on VS Code Insiders. Great. Thank you!!
Doesn't work properly from flat plain Windows Terminal / Powershell 7 on Windows 11 either.
Don't even have to involve WSL.
Same issue for me on:
And also no WSL