Visual Studio Code Keyboard Shortcut

To see the Visual Studio Code keyboard shortcut you do not need to visit a web or search anywhere else. You can find it inside Visual Studio Code itself.

To see the list of keyboard shortcut do the following things:

File, Preferences, then Keyboard Shortcuts,


It will display the list of available keyboard shortcuts. In 2nd window it has opened a keybinding.json file
In keybinding.json file you can keep all your custom keyboard binding.


Adding new Keybinding (Ctrl +K Ctrl +K)


Press Ctrl+K 2 times and it will open a pop up window to set up a new keyboard binding


Now press the key combination which you want to use. Let us say I want to use the keyboard shortcut "Ctrl+Shift+Alt+O" for clipboardCutAction. So press “Ctrl+Shift+Alt+O” and it will automatically display the combination in keybinding box.


Now press enter. It will add a line in json file.

  1. {  
  2.     "key""ctrl+shift+alt+o",  
  3.     "command""commandId",  
  4.     "when""editorTextFocus"  
  5. }  
But I want to use it for clipboardCutAction so edit the above code and make it
  1. {  
  2.     "key""ctrl+shift+alt+o",  
  3.     "command""editor.action.clipboardCutAction",  
  4.     "when""editorTextFocus"  
  5. }  
So you can see that I have just replaced "command": "commandId" with "command": "editor.action.clipboardCutAction",

Now save the .json file and go to the editor and open a file.
Press "Ctrl+Shift+Alt+O". It will cut the current line. In the same way you can set shortcut for other functionality also.

How to find out what specific key combination is bound to which command

Press "Ctrl+Shift+O". The key combination "Ctrl+Shift+O" is bound to Quick Outline.
Now I want to check that if a key combination “Ctrl+L” is bound to any command.


You can see that there is no key combination for “Ctrl+L”, so now I am going to add a key combination“Ctrl+L” for deleting the current line.

I am using the same key combination mentioned above for keybinding i.e. (Ctrl+KCtrl+K).

Then add key combination for “Ctrl+ L”.

The following line will be added in json file.
  1. {  
  2.     "key""ctrl+l",  
  3.     "command""editor.action.deleteLines",  
  4.     "when""editorTextFocus"  
  5. }  
Save the keybinding json file. Now we can use “Ctrl+L” to delete the line. To verify that the key combination has been added or not you can repeat the same steps. Press "Ctrl+Shift+O" to open Quick Outline. Then type “Ctrl+L”


You can see that it is displaying that “Ctrl+L” key combination is bind to a command. If I select any keying combination then cursor automatically moves to that particular key combination.


Removing a key combination

I am going to remove the key combination "Ctrl+C". The default code for this key combination is
{ "key": "ctrl+c", "command": "editor.action.clipboardCopyAction" } Now I will open a new keybinding window.
Go to File menu, Preferences, then Keyboard Shortcuts. Assign "Ctrl+C" in the box and press enter Edit the command and it should be { "key": "ctrl+c"} . save the User/keybindings.json file.
AS I have removed the data for “command” so now the keycombination “Ctrl+C” will not work.

Add key combination for specific type of file only

Adding a key which will work only with C# language
{ "key": "ctrl+shift+c", "command": "editor.action.blockComment",
"when": "editorTextFocus&&editorLangId == 'csharp'" },
Here I am using the editorLangId context key so it will only work for C#.


Up Next
    Ebook Download
    View all
    View all