5

Is there a way to setup up the same shortcuts in both Visual Studio Code and Visual Studio (without having to change them all manually each time)?

I for example use Alt+Shift+A in Visual Studio Code quite frequently. But the same shortcut in Visual Studio opens a "Add Existing Item" explorer.

I found out this, but it doesn't change the shortcut as I was expecting:

enter image description here

How to add the same Visual Studio Code shortcut to Visual Studio ?

Crocsx
  • 2,534
  • 1
  • 28
  • 50
  • Does this answer your question? [Align Visual Studio Code and Visual Studio Key Mappings](https://stackoverflow.com/questions/42576266/align-visual-studio-code-and-visual-studio-key-mappings) – Michael Freidgeim Nov 10 '22 at 07:16

3 Answers3

4

Option A: The Microsoft-provided "Visual Studio Keymap" extension for VS Code at https://marketplace.visualstudio.com/items?itemName=ms-vscode.vs-keybindings (I don't know if it has the specific mapping(s) you want)

Option B: The "Visual Studio Code" keyboard mapping scheme within Visual Studio's keyboard options (but you said that one didn't have the specific mapping(s) you want)

Option C: Manually edit the key bindings, which can then sync in VS Code and/or Visual Studio with the built-in https://code.visualstudio.com/docs/editor/settings-sync / https://learn.microsoft.com/en-us/visualstudio/ide/synchronized-settings-in-visual-studio but I can understand if manual edits aren't preferred.

Andrew D. Bond
  • 902
  • 1
  • 11
  • 11
1

You can change binding with this configuration and add more key binding

  1. Go to File->Preferences->Keyboard Shortcut

  2. This will open two files beside each other like in the screenshot below: vs-code-keybinding-shortcut

  3. Now, on the window on the right i.e. the keybindings.json file, you can define your own shortcut in the below format:

// Place your key bindings in this file to overwrite the defaults [ {
"key": "ctrl+k ctrl+d", "command":"editor.action.format" } ]

Mr Mayur
  • 571
  • 6
  • 9
0

Visual Studio 2022 includes the Tools, Options menu, where you can find the Environment, Keyboard options. You can assign the preferred shortcuts manually, or also select “Visual Studio Code” from the “Apply the following additional keyboard mapping scheme” dropdown list.

The above answer from the Microsoft community, for more details: https://learn.microsoft.com/en-us/answers/questions/118159/how-can-i-put-visual-studio-code-shortcuts-in-visu