Maxi Wu
Maxi Wu

Reputation: 1494

VSCode some shortcuts not working properly

latest version 1.40.1 on Windows 7 x64. I am developing in Java.

The most common shortcut, "go to definition" F12 and "auto fix" ctrl+dot I tested it on another computer with 1.40.1. It works properly. I have follow the key binding troubleshooting guide. When I record my key ctrl+dot. It shows ctrl+oem_period. Looks like the OS is sending the correct keys to VSCode.

I couldn't find a way to reset VSCode key bindings and do not know what is actually causing this. What should I do next? Completely reinstall everything is the last resort.

Upvotes: 62

Views: 197185

Answers (30)

monalisa717
monalisa717

Reputation: 3417

You may also need to check the when clause of the Keybinding. In my case, I was struggling with why "Command+R" wasn't reloading the window on my Mac. By right-clicking on the row of the relevant command in Keyboard Shortcuts, then clicking "Change When Expression" and removing the expression completely, the keybinding now works as expected. Source: https://github.com/microsoft/vscode/issues/108393#issuecomment-706215895

The when clause may also show prerequisite situations for the keyboard shortcut to work. For example, if you select a file in the folder list pane and then try the keyboard shortcut for Trim Trailing Whitespace (Ctrl+K, Ctrl+X on Windows), it fails with a status bar message saying The key combination (Ctrl+K, Ctrl+X) is not a command. Looking at the when column in File > Preferences > Keyboard Shortcuts shows that one of the prerequisites for Trim Trailing Whitespace is editorTextFocus. And indeed, clicking the cursor into the text editor window after selecting the file in the folder list pane causes the keyboard shortcut to start working.

Screenshot of VS Code Keyboard Shortcuts tab showing editorTextFocus as one of the values in the When column for Command Trim Trailing Whitespace

Upvotes: 5

Iteqa-Services
Iteqa-Services

Reputation: 1

This problem occurs mostly on VScode installations which were installed using user-installer in windows system. Solutition: Close the running Vscode application. Get the System installer under https://code.visualstudio.com/download# for windows and excecute it. Restart your application and the shortcuts problem is gone

Vscode System installer

Upvotes: 0

Jim Fischer
Jim Fischer

Reputation: 507

In addition to my previous answer to this question, I just now discovered that multiple key bindings within VSCode stop working whenever I open/run Microsoft Word.

Upvotes: 0

Jim Fischer
Jim Fischer

Reputation: 507

For me, the key binding "Alt+Z" (toggle "Word Wrap") wasn't working within VSCode on Windows 11. The computer I'm using has an AMD graphics chip, and there's an "AMD Software" app that, by default, allocates multiple keyboard shortcuts at the system level, including "Alt+Z".

I opened the AMD Software app, opened the app's SETTINGS page, selected the HOTKEYS tab, and disabled the app's keyboard shortcuts. Afterwards, I was able to use the "Alt+Z" key binding within VSCode.

enter image description here

Upvotes: 0

Kaiser Sofi
Kaiser Sofi

Reputation: 21

The Simple Solution i found is the Extention called Vim, Uninstall it Works okay thank me later.

Upvotes: 0

Zzhh
Zzhh

Reputation: 1

Delete any vs code extension you have downloaded that has its commands.

Upvotes: 0

Manishyadav
Manishyadav

Reputation: 1736

I solved this issue by using command pallete , shortcut option , I followed the following steps,

View /CommandPallete/keyboard Shortcuts 

Just take a look that, is there any extension using those shortcut to invoke their functionality. In my case BlackBox extension was using those shortcut to launch their tab.

Upvotes: 0

Mangala Karunarathne
Mangala Karunarathne

Reputation: 319

  • Go to keyboard shortcuts as follows File > Preferences > Keyboard Shortcuts enter image description here

  • Open keyboard Shortcut (JSON) file enter image description here

  • It will show something like this... enter image description here

  • Go to this link check here and add that content to that above keybindings.json file

  • Save them and check your short cut. It should work now... It worked for me... All the best...

Upvotes: 0

AzharYakub
AzharYakub

Reputation: 89

On VS Code,

  1. Click on Help, then click on Show All Commands. OR you can open the command palette directly with shortcut: ctrl + shift + p (on Windows/Linux) or cmd + shift + p (on Mac).
  2. Paste Developer: Toggle Keyboard Shortcuts Troubleshooting on the search bar.
  3. Click on the gear sign next to the command Refer the image
  4. You may have keybinding search input there so click on the last icon 'Clear Keybinding Search Input(Escape)' click on the highlighted icon
  5. Search the desired keyboard shortcut and see if any result is there. If you find any entry, right click and remove keybinding.

Upvotes: 8

Gad Iradufasha
Gad Iradufasha

Reputation: 151

Sometimes, The installed extensions may be the cause, For example:

I installed "Vim" extension Thus, Some shortcuts failed to work again. Some of those shortcuts are: "Ctrl + A" , "Ctrl+C", "Ctrl+X" but I uninstalled VIM extension to make my shortcuts work again!

Why? Some extensions has their own shortcuts which can confuse you because of different functionalities!

Upvotes: 0

Ariz Muajianisan
Ariz Muajianisan

Reputation: 21

In my case, I can't use ctrl+`. I've tried to restart VS Code but this problem still occurs.

After some checking, I figure out that my keyboard language accidentally changed to Japanese, after switching to English, the shortcut ran perfectly.

Pict. Change keyboard Language

Upvotes: 2

Alex Xie
Alex Xie

Reputation: 36

For me, It is the keyboard layout setting that causes this. Use English US keyboard setting.

Upvotes: 0

Ginger Bread
Ginger Bread

Reputation: 625

Extensions you add to VSCode also can override the ordinary behavior of shortcuts. I faced to this problem, I've noticed that the ordinary shortcut command + L which selects the whole line, does not work, and the reason was Live Server extension, which overrides that shortcut, after its deletion shortcut became work properly

Upvotes: 1

butch3r
butch3r

Reputation: 1

I just deleted folder in %APPDATA%\Code\ resets whole vs code and fixed my problem with alt + b and other vs code shorcuts not working

Upvotes: 0

Geoffrey Hale
Geoffrey Hale

Reputation: 11488

MacOS users,

This is a default macOS shortcut. VSCode is never getting the meta+shift+L message from your OS. Your OS is hijacking it. You need to disable it.

System Settings > Keyboard > Shortcuts > Services > uncheck: Search with Google


Source: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000435950/comments/360000170990

This is a default macOS shortcut, you can disable it at System Settings | Keyboard | Shortcuts | Services| Search with Google. https://apple.stackexchange.com/questions/180038/strange-behavior-within-ms-word-using-command-shift-l-launches-safari-sometimes

Upvotes: 2

anon
anon

Reputation:

This worked for me to fix CTRL+Space "Trigger Suggest". First I found and disabled this setting in: System Preferences > Keyboard > Shortcuts > Input Sources

keyboard_prefs

Then I followed @ryandidevar's instructions and replaced everything for Mac: https://stackoverflow.com/a/72187880/14353462

Finally, I set "Trigger Suggest" in VSCode > Preferences > Keyboard Shortcuts to: CTRL+§ (which is right next to my "Z" key). CTRL+Space just would not be accepted under any circumstance. Now hitting CTRL+§ finally brings up the suggestions!

Upvotes: 2

Mayank
Mayank

Reputation: 59

In my case, I have installed some "vim keyboard extensions" and others. so I have uninstalled all the extensions related to the "keyboard" i.e. "vim keyboard extension" and now it is working fine. it is recommended to check if you have downloaded any extensions for the "keyboard" in the extensions and uninstall it. It might solve the issue.

Upvotes: 2

Vasily Hall
Vasily Hall

Reputation: 961

Woo, found my issue was Razor Naga stuff. After I updated some of the Razor apps (it has Synapse, Cortex, etc), this issue started happening. Now, I saw these apps are running in the background although I am not using the devices at this time, and once I quit them, VSCode went back to normal thankfully.

Upvotes: 0

Ryan Didevar
Ryan Didevar

Reputation: 678

99% works.

Forget everything that may overrides your keyboard shortcuts. The problems is your keybindings.json file, if you fix it you'll fix your problem.

I found the solution and I've explained it in the following link: Why vscode shortcuts don't work properly?

Upvotes: 2

Bill Murrin
Bill Murrin

Reputation: 1

In my case, my Ctrl keys were mapped to the Toggle extension and this extension could not overwrite one of my settings in the settings.json because I had pending changes that hadn't been saved. Once I saved the file, I was able to use the toggle keyboard binding again. I used the guidance from Martin above to determine the cause of the issue.

Upvotes: 0

Josh
Josh

Reputation: 339

My issue is niche but never know, might help someone - YouTube Music Desktop player app was hijacking cmd, shift + l for me.

Upvotes: 0

Deepa
Deepa

Reputation: 1

I have tried many methods to solve this problem ,not every problem of mine got solved so I use this method after I cant find the solution.
you can first uninstall the VS code and then delete the .vscode file from C=>user=>admin=>.vscode after that reinstall vscode ,from my end its working fine after doing this.

Upvotes: 0

code_till_u_die
code_till_u_die

Reputation: 57

Try turning on Num Lock, it worked for me.

Upvotes: 3

Sunil
Sunil

Reputation: 849

Just restarted the Visual Studio Code and the keys are working fine.

Upvotes: 7

rhythmo
rhythmo

Reputation: 949

In my case, "cmd+k cmd+0" which helps to fold all regions was not working. Another extension was using the same shortcut. I followed the steps below to fix it.

Here are the steps to fix this

  1. Press "cmd+shift+p" to open command palette

  2. Type "Preferences: Open Keyboard Shortcuts" and hit enter

  3. Press "option+cmd+k" to start recording keys.

  4. Press the short cut keys that are not working (in my case "cmd+k cmd+0" ). This will list all the instances of that shortcut keys. And there are probably multiple instances of the same keybindings with some of them being used by an "Extension" as shown under the "Source" column.

  5. Remove that and keep only that instance which says "Default" under "Source" column.

Now, you should able to use the default keyboard shortcuts.

Upvotes: 15

Bhargav Anand
Bhargav Anand

Reputation: 41

Sometimes this can happen because of change in environment variables. Please check if any recent program installations has made that change

Upvotes: 2

Akash Singla
Akash Singla

Reputation: 21

Resolved :

Facing similar issue. Several keyboard shortcuts stop working when code starts running. In my case it was happening because of notepad++ extension. Disabling that extension resolves the issue.

Upvotes: 2

Giovani Cassiano
Giovani Cassiano

Reputation: 321

This resolves my issue:

Change your "keyboard.dispatch" to keyCode in the file settings.json

{
    "keyboard.dispatch": "keyCode"
}

Upvotes: 22

Martin van Driel
Martin van Driel

Reputation: 1857

With the command Developer: Toggle Keyboard Shortcuts Troubleshooting, you can see which command is linked to a shortcut. It could happen that an extension is overriding the expected behaviour.

For example, I had an extension overriding the shortcut to reopen a closed tab, which didn't work anymore.

Upvotes: 96

retr0
retr0

Reputation: 744

I was facing the same problem after I updated my Intel Graphics Command Center using Windows Updates.

The Add One Cursor Above/Below shortcuts were not working for me.

I started the Intel Graphics Command Center, and then went to System > Hotkeys tab, Enabled System Hotkeys as shown in the picture below.

enter image description here

I flipped my screen a couple of times using the keyboard shortcuts and then disabled once again.

Then switched back to VSCode and the keyboard shortcuts were working!!

Upvotes: 6

Related Questions