'Same shortcut in Visual Studio and Visual Studio Code
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:
How to add the same Visual Studio Code shortcut to Visual Studio ?
Solution 1:[1]
You can change binding with this configuration and add more key binding
Go to File->Preferences->Keyboard Shortcut
This will open two files beside each other like in the screenshot below:
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" } ]
Solution 2:[2]
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://docs.microsoft.com/en-us/visualstudio/ide/synchronized-settings-in-visual-studio but I can understand if manual edits aren't preferred.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mr Mayur |
Solution 2 |