How can I import Visual Studio keybindings into VS Code?

578 Views Asked by At

There are several answered questions about importing VS Code keybindings into Visual Studio, but I need to do the opposite.

My VS 2019 keyboard scheme (on Windows) is based on the "Visual C++ 6" mapping with additional customizations and I would like to use the same in Visual Studio Code (on Linux).

1

There are 1 best solutions below

0
On

As far as I know, at the time of this writing, no such feature exists in VS Code to do this.

At the least, there is an extension that apparently provides the default keybindings of VS to VS Code: https://github.com/microsoft/vscode-vs-keybindings, so if you're okay with setting up your non-default Visual Studio settings again, where such settings have analogous settings in VS Code, you can use that as a starting point.

The author is listed as Microsoft itself, so hopefully that means it does a faithful job of importing as many of the key bindings as possible.

There are some likely caveats.

  1. Not all key bindings will make it through the import because not all actions in Visual Studio will have equivalent bindable commands in VS Code.
  2. Hotkeys provided by extensions that exist for Visual Studio, but not Visual Studio code will not make it through (e.g. ReSharper bindings).
  3. Updates to the extension/GitHub repo look to be about ~2 years old as of the time of this post, but there is a way to add key bindings.

I tried googling to see if someone had already raised a feature-request for such a feature. I googled "github vscode issues keyboard shortcut from visual studio" and "site:github.com/microsoft/vscode/issues import ".vssettings"" and didn't see anything that looked promising in the top search results.

(Related question: Is there a way to export shortcuts from Visual Studio?, which shows that when you export settings from Visual Studio, you get a .vssettings file, hence my second google search query)

Probably, how such a feature would be implemented would be to parse a .vssettings file and convert it on a best-effort basis into a VS Code settings.json and keybindings.json file.

I'd suggest that you raise a feature-request issue ticket to the VS Code GitHub repo describing the use-case and suggesting the approach of converting a .vssettings file into a settings.json and keybindings.json file. Luckily for you, both Visual Studio and Visual Studio are developed by Microsoft, so they're probably fairly equipped to implement something like this. The real question is whether your feature request ticket will get enough community support to get added to their backlog, and prioritized in the long list of other high-demand, yet-implemented feature-requests. The issue ticket has now been raise at https://github.com/microsoft/vscode/issues/178521.