claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

VSCode Terminal Shift+Enter Keybinding Installation Failure

Open divyang-patel opened this issue 9 months ago • 10 comments

Bug Description /terminal-setup is throwing error "Failed to install VSCode terminal Shift+Enter key binding" on Cursor IDE.

Environment Info

  • Platform: macos
  • Terminal: cursor
  • Version: 0.2.19
  • Feedback ID: db0d0ea4-71a4-4ae9-b50d-5cde5a33ea3b

divyang-patel avatar Feb 27 '25 14:02 divyang-patel

ways to recreate this issue-

  1. u r opening claude-code from a remote-ssh and the remote os and local os is diff it will cause issue
  2. using cursor.

Cause for each of the above mentioned issue-

  1. although it is not public but from what i can see from the built code. the issues lies in the way the keybinding is added. so the home directory is found from the terminal and it returns the home dir of the machine where the terminal is running. and then it is joined with OS specifc keybindings.json path.
  2. "Code" (VSCode) is hard-coded in path string.

I tried to look around for a solution but it seems tricky atleast for issue 1. For issue 2 maybe u can run "code --status" and "cursor --status" to find which one is running. but maybe user is running both. u can check the command u ran in the status so maybe u can use regex or simple string search to confirm u r on which editor by checking the status output. in Status output under "ptyHost" you will find the "code --status" or "cursor --status" command. it shows full path of code/cursor in windows. so maybe need to create unique pattern checks for each os. Or maybe theres a much simpler way I dont know.

Although not a solution to the bug itself heres a way to manually bind the key: You can just manually add this keybinding in the json or from UI - { "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\\\r\n", }, "when": "terminalFocus" }.

SamimAB avatar Mar 02 '25 23:03 SamimAB

I'm having the same problem, opening Claude Code in vscode terminal. BUT /terminal-setup ran in a standalone terminal, although the command didn't show up in the list of available commands. Is this a command that is ONLY supposed to do something in vscode context? So it didn't 'run' in a standalone, it did something else?

misbell avatar Mar 15 '25 20:03 misbell

I have the same problem. My VS code can't even install "/terminal-setup", but I can install it when I open a separate iTerm2 window, and I can also use shift+enter to wrap lines normally. However, this has no effect on the integrated terminal in VS code, even if I replace it with "iTerm.app" by default.

shushu789 avatar Mar 23 '25 05:03 shushu789

I think this is fixed. Please give new repro instructions if not.

wolffiex avatar Mar 25 '25 19:03 wolffiex

I think it has not been fixed yet. The latest version of Claude code is: v0.2.54, VS code version: 1.98.2, but it still cannot be installed in the VS code integrated terminal (zsh). Its prompt is as follows:

/terminal-setup ⎿ Error: Failed to install VSCode terminal Shift+Enter key binding

It works normally in iTerm2:

/terminal-setup ⎿ Installed iTerm2 Shift+Enter key binding ⎿ See iTerm2 → Preferences → Keys

I have changed the integrated terminal in VS code to iTerm.app, but it doesn't work.

My device is a MacBook (Apple M2) and the system is macOS 15.3.2

shushu789 avatar Mar 26 '25 04:03 shushu789

On Mac I was only able to get this working by editing the keymap manually with the following:

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

Note: that space in front of carriage return is important (for some unknown reason) - it won't work without it

mtford90 avatar May 02 '25 12:05 mtford90

I'm having trouble getting this working in Cursor, I tried the config in the comment above mine, but wasn't able to get shift + enter to behave as expected.

Hitting shift + enter sends the message vs. my expected behavior is that it inserts a new line into the text input box.

Works great/fine for me in iTerm 2

jakedahn avatar May 27 '25 17:05 jakedahn

work for me when i used multiple profile in cursor you must be setting keybinding in your profile like this

Setting > Profile >Profiles Image

triadmoko avatar May 31 '25 14:05 triadmoko

On Mac I was only able to get this working by editing the keymap manually with the following:

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

Note: that space in front of carriage return is important (for some unknown reason) - it won't work without it

in Ubuntu 24, Vscode. any leading characters(\\ or (space)) is work

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

ninyawee avatar Jun 11 '25 09:06 ninyawee

Same here.

I got it to work by ignoring the file that Claude Code makes in it's own location, and instead adding the keybinding to the VSCode's profile json. (/home/username/.config/Code/User/keybindings.json). This seems like a very easy fix.

Not sure why Claude puts the file in their own location, but if the intention is that VSCode will combine the files, it doesn't seem to be doing it.

The issue was not a duplicate entry for SHIFT+ENTER, I removed all of my others.

jnz86 avatar Jun 11 '25 17:06 jnz86

work for me when i used multiple profile in cursor you must be setting keybinding in your profile like this

Setting > Profile >Profiles Image

Thank you. This is the only way I can work—I'm using SSH from Windows to connect to Linux. I've tried almost every method, but none of them allow me to use Shift+Enter for line breaks.

isCopyman avatar Jul 01 '25 02:07 isCopyman

On Mac I was only able to get this working by editing the keymap manually with the following:

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

Note: that space in front of carriage return is important (for some unknown reason) - it won't work without it

This was the only fix that worked without adding an extra \ at the start of a new line.

ibrahemid avatar Jul 29 '25 04:07 ibrahemid

Just a heads up for anyone using VScode on windows AND WSL. When you run /terminal-setup it sets up keybindings in linux (wsl)... you need to get it setup in windows for this to work. You can do that going into the profiles section in settings like the screenshot above.

that0n3guy avatar Aug 22 '25 14:08 that0n3guy

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.

github-actions[bot] avatar Dec 04 '25 10:12 github-actions[bot]