简体   繁体   中英

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?

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 ie 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" } ]

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM