Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl + C shortcut isn't working inside a build-in terminal in Visual Studio Code #51

Open
jedrzejchalubek opened this issue Dec 31, 2020 · 10 comments

Comments

@jedrzejchalubek
Copy link

A standard Ctrl + c shortcut which terminates the current process is not working in the build-in VSC terminal. The same shortcut works perfectly in standard and iTerm terminals. I have all 'Complex modifications' enabled.

I suppose it's a problem that we want keys to be remapped when using VSC, but disabled when focusing it's inside the terminal. There is any "way around" for this problem?

@samuelneff
Copy link

I personally got around this problem by excluding VSC from all remappings and then do the mapping inside VSC itself. Then I use ctrl-c to break in Terminal and mac-c to copy.

It's not up-to-date, but my fork is here for comparison. https://github.com/samuelneff/karabiner-windows-mode/tree/sam-additions

@MNorgren
Copy link

I am also struggling with this very same issue. Have you come to any conclusion?

@jedrzejchalubek
Copy link
Author

@MNorgren Nope, I didn't find any reasonable or comfortable solution. For now, just closing and creating a new terminal in VSC whenever I need it to terminate it 😞

@WhiteHotLoveTiger
Copy link

I've also having this problem, but in PyCharm.

Would it be possible to only map the left Ctrl key for Ctrl + c to copy, and leave the right Ctrl alone, so that it would still work for sending a normal Ctrl + c interrupt at the terminal?

@rux616
Copy link
Owner

rux616 commented Apr 11, 2021

I just made a change (#58) to use the suggestion of only using left control for the bind. @jedrzejchalubek @MNorgren @WhiteHotLoveTiger, please try the new binding and see if that at least serves as a decent workaround.

There's also the alternative of leaving the IDE's off the CTRL+C binding altogether, meaning CMD+C would have to be used to copy, but that might be a worthy tradeoff? Let me know and we'll work at creating a worthwhile solution.

@Dunky13
Copy link

Dunky13 commented May 8, 2021

It doesn't work well with the PC-Style Copy/Paste/Cut

@mehulparmariitr
Copy link

Any working solution for this?

@nikksan
Copy link

nikksan commented Nov 17, 2023

You can set a custom shortcut and target the terminal in vscode.

{
      "key": "cmd+c",
      "command": "workbench.action.terminal.sendSequence",
      "args": {
        "text": "\u0003"
      },
      "when": "terminalFocus"
  }

Note that I have already swapped cmd with ctl

@Jaimi5
Copy link

Jaimi5 commented Nov 29, 2023

I did a rule that when clicking Ctrl+Shift+C it will execute the Ctrl+C, even if it is remapped with the karabiner-elements.

{
    "description": "Quit application from terminal with Control+shift+c",
    "manipulators": [
        {
            "type": "basic",
            "from": {
                "key_code": "c",
                "modifiers": {
                    "mandatory": [
                        "left_control",
                        "left_shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "shell_command": "osascript -e 'tell application \"System Events\" to keystroke \"c\" using control down' end tell"
                }
            ]
        }
    ]
}

Hope this helps someone!

@arishokri
Copy link

I just made a change (#58) to use the suggestion of only using left control for the bind. @jedrzejchalubek @MNorgren @WhiteHotLoveTiger, please try the new binding and see if that at least serves as a decent workaround.

There's also the alternative of leaving the IDE's off the CTRL+C binding altogether, meaning CMD+C would have to be used to copy, but that might be a worthy tradeoff? Let me know and we'll work at creating a worthwhile solution.

This was such an amazing idea. I'm not sure why I didn't think of this before but I'm actually using Karabiner on a Mac and was facing the same issue. Using left_control for these windows_like combinations and then leaving the righ_control for Mac-Like combinations was the best solution for a problem that plagued me for the past couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants