NoviceMe
NoviceMe

Reputation: 3256

cmd+c is not working on Visual Studio Code

I have following in settings:

{ "key": "cmd+c",                 "command": "editor.action.clipboardCopyAction",
                                     "when": "textInputFocus" },

This is driving me crazy, have tried everything but am unable to make copy command work in Visual studio code. I have to write click and then select copy. Shortcut does not show in VSC. Does anyone know why?

Upvotes: 3

Views: 7878

Answers (6)

Øyvind
Øyvind

Reputation: 3

For me, the issue was that I have created a shortcut that used "cmd+c+a". So the IDE was waiting for a second key.

Upvotes: 0

microsoft_wtf
microsoft_wtf

Reputation: 1

Ran into this issue too. Seemed to work again when I reopened (was closed) the terminal panel (cmd + `), focused the terminal (click it), and closed it again (click the x top right). I also toggled the side bar (cmd + b) and right side bar (cmd + option + b).

It is scary that the most popular IDE can have this much trouble copying text.

Upvotes: 0

Rohit Kumar
Rohit Kumar

Reputation: 1321

Go to VSCode editor and right click on mouse.

  • check if it is showing keyboard shortcut for copy command. check if it is showing keyboard shortcut for copy command

  • If it is not showing. Go to command palete, and open keyboard shortcut JSON file.

  • enter image description here

  • In this file search all entries for CMD+C and delete those entries in the JSON.

It will start showing keyboard shortcut for the copy in the mouse menu and work also.

Upvotes: 0

OleksiiGa
OleksiiGa

Reputation: 51

In my case with macOS (every time after cmd+C had clicked the behavior was like the keyboard turned on "insert" mode). I deleted the default shortcut, and without specific changes turned back the totally same shortcut, after restart VSCode all works fine

Upvotes: 0

JeffreyGoines
JeffreyGoines

Reputation: 94

I don't know why, but in my case I needed to remove the following default keybinding in order for Command+C to start functioning again, therefor my keybindings.json file now looks like this:

[
    {
        "key": "cmd+c",
        "command": "-search.action.copyMatch",
        "when": "fileMatchOrMatchFocus"
    }
]

(Perhaps using VSCode on a Mac machine and a Linux machine is related, however but this is a wild guess).

Upvotes: 0

Alex Myers
Alex Myers

Reputation: 7155

Open your Keyboard Shortcuts by going to File > Preferences > Keyboard Shortcuts.

In the search bar at the top, type "cmd+c" to search for all shortcuts using those two keys. Now look at the "When" column for all instances of "textInputFocus". You need to make sure that the only command mapped to cmd+c during textInputFocus is the Copy command.

Below is an example where ctrl+c will fail to copy on my Windows setup because a second command is mapped to ctrl+c during textInputFocus.

enter image description here

Upvotes: 9

Related Questions