Make Visual Studio use VS code shortcut keys / key bindings - visual-studio

I've been using VSCode a lot lately and have gotten used to the keys-shortcuts/key-bindings (Ctrl+D, Ctrl+P, Alt+leftArrow, etc). However I've recently had some work where I needed to use regular Visual Studio (Microsoft Visual Studio Enterprise 2019) and it's painful remembering two different shortcut keys.
Is there a way to import VSCode key-shortcuts to into regular Visual Studio?
I've looked at this question and there wasn't much help besides manually changing them one at a time.
UPDATE: now the above post answers the question now that I posed Francois du Plessis's answer there.

If you go to Tools -> Options -> Environment -> Keyboard. There should be an option to select Visual Studio Code as a Keyboard mapping scheme

You can create your own settings file based on an existing Visual Studio file.
Simply add your settings to it from VSCode keybinding setting file.
VSCode's keybinding settings is stored in keybindings.json json-formated file.
open file in menu
File->Preferences->Keyboard Shortcuts
or on Windows file path like that
C:\Users\<user name>\AppData\Roaming\Code\..\keybindings.json
Visual Studio's keybinding settings is stored in CurrentSettings.vssettings xml-formated file.
on VS menu:
Tools->Import and Export Settings
then select 'Import select environment setting' radiobutton and click 'Next'
you'll see browser for import your file.
on Windows file path like that
C:\Users\<user name>\Documents\Visual Studio 2019\Settings\
You can read more about it at this:
Make Visual Studio use VS code shortcut keys/key bindings

Related

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

What are the corresponding action names between IntelliJ IDEA and Visual Studio + ReSharper?

For example, IntelliJ IDEA's keymap action Main menu -> Edit -> Copy reference would map to ReSharper_CopyFqn action in Visual Studio keyboard setup. Is there a more complete list somewhere? Ideally, the list should also contain key shortcuts which I could edit and import to Visual Studio.
I have attempted to map IntelliJ commands to Visual Studio commands and have an XML file that provides Visual Studio keyboard bindings based on my mappings.
I have include additional information in the comments about how closely the various Visual Studio features align with the IntelliJ commands.
You can view the IntelliJ-VisualStudio keyboard mapping file here:
https://github.com/justcla/KeyBindings/blob/master/KeyboardSchemes/VSSettings/IntelliJ.vssettings

VS2012 is missing "format document" feature

I have VS2012 Pro installed, and there is no "Format Document" feature under Edit -> Advanced. I used this all the time in VS2010, and would like to continue using it. Is it just not available in the Pro version of 2012?
It is missing from the menu but you can still access is via shortcut
Ctrl+E,D
If you're talking about other types of files other than .cs, I think VS will generally go by the file extension.
I was trying to edit a .txt file with xml in it and couldn't get the menu option or the shortcut keys to work. Then renamed the file to .xml and all was good.
In VS2012 the command is there as well. It depends on the current settings. I still have it under Edit -> Advanced where it shows the Ctrl + E + D shortcut that is assigned to it.
Please check the following:
Go to Tools -> Options -> Keyboard and check which additional keyboard mapping scheme is applied in the drop down on top. For me it states "Visual C# 2005"
Then, as Jarek already suggested search in the 'Show command containing' for 'Edit.FormatDocument' and see if there is a shortcut assigned now.
Which kind of environment have you choosen when installing VS 2012? Was it for C#? If you want to change that you can do it unter Tools -> Import and Export Settings as described here
Last but not least I'm not sure any more if this function actually is part of Visual Studio 2012 itself (I'm 98% sure it is, but 98 is not 100) so please check if installing the PowerCommands extension solves this issue (Even though the name suggests that they are only for VS 2010 they also support VS 2012). Note that the PowerCommands are also integrated now in the ProductivityPowerTools directly.
It's called "Reformat Selection" in XML Editor toolbar.

Visual Studio 2010 IDE question

When I double click an item in the find window, the C/CPP file opens in a tab next to the find window. I want it open in the main window (center) along with the other c/cpp files. Is there a setting to get this behaviour ? Thanks
Perhaps that setting has been modified somewhere. I've tried to reproduce the behaviour in a new(ish) installation of Visual Studio 2010, and can't reproduce. Perhaps you've chosen the C++ Development Settings where the behavior is different from the C# Dev Settings.
Consider resetting your Visual Studio 2010 settings.
Tools -> Import and Export Settings -> Reset All Settings

Configure Eclipse to use VS.Net shortcuts?

I've started doing some Python Programming using Eclipse. However, I'm a .Net programmer and I'm use to the keyboard shortcuts in VS.Net 2008. Is there any quick way to reconfigure VS.Net to use the visual studio shortcuts. I've found this other question, but the suggested methods don't work. I've installed CDT and selected the Visual Studio Keys, but it doesn't seem to change any of the key mappings.
That's strange because after installing the C/C++ Development Tools (CDT):
alt text http://img39.imageshack.us/img39/4002/screenshot001ey.png
And picking up the Microsoft Visual Studio scheme (from Windows > Preferences > General > Keys):
alt text http://img64.imageshack.us/img64/9844/screenshot002r.png
My binding are definitely altered as shown below (ok it's just a small example but it illustrates the change and all bindings mentioned by #VonC are there):
alt text http://img4.imageshack.us/img4/1401/screenshot002gd.png
If the CDT Visual Studio mapping does not work, you need to import custom shortcut files for the usual Visual Studio shortcuts.
This SO question mentions this article, with this minimal set:
New PHP File: Ctrl+N
Next Editor: Ctrl+Tab
Previous Editor: Ctrl+Shift+Tab
Find and Replace: Ctrl+F
Find Next: F3
Find Previous: Shift+F3
Open Search Dialog: Ctrl+H
New File: Ctrl+N
Go to line: Ctrl+G
File.Close: Ctrl+W

Resources