I have VSCode on a Linux (Ubuntu 20.10) and Windows 10 machine. On working through the keybindings on each, I observe the following default out of the box settings:
The command editor.action.copyLinesUpAction is mapped on Windows to Shift+Alt+UpArrow. The same keybinding, however, on Linux is mapped to editor.action.insertCursorAbove.
There could be other examples as well. Is there any documentation of an exhaustive list of such differences in commands for the same keypresses on different operating systems?
I use vs-code as my go-to editor on Windows. Recently I've installed on Ubuntu and now the default key mapping is different.
Is there any way I can set the key mapping on Ubuntu similar to what they were for Windows, or at least a subset of it?
I have created an extension that provides the default Windows keybindings. It is on the VSCode extension marketplace and called Windows Default Keybindngs.
I have tested it on Linux with VSCode 1.38.0 and 1.36.1.
The new bindings take precedence where there is a conflict, but existing, non-conflicting bindings are still available.
Basically all I did was use HolyBlackCat's suggestion to run "Preferences: Open Default Keyboard Shortcuts (JSON)" and stuff the result into the appropriate place in package.json. (Plus document it and figure out how to publish it!)
Update 2020-06-05: In response to a question in a comment, I did a search and found LinuxKeybindings, an extension that provides the default Linux bindings. I have not tried it myself but this could be useful for those wanting the Linux bindings instead of Windows bindings.
A quick way to transfer the default keymap without an extension:
VS Code Windows (source)
open "Show All Commands" / Ctrl+Shift+P
select Open Default Keyboard Shortcuts (JSON) (docs)
Note: #Ville Venäläinen's answer did not work for me for default key bindings.
copy everthing to clipboard or a temporary file (like you need it)
VS Code Linux (target)
open user keybindings / CTRL + K CTRL + S → click Open Keyboard Shortcuts (JSON) button
paste all previously copied settings to this file. If you already have custom user settings, make sure to don't overwrite them. Also preserve the file JSON structure [{}, {}, ...].
Additional notes
You can make a backup of the keymaps before. Default file locations analogue to settings.json:
Linux: $HOME/.config/Code/User/keybindings.json
Windows: %APPDATA%\Code\User\keybindings.json
If needed, also copy custom user keyboard shortcuts in source and append them in the target keybindings.json file (as explained above).
This worked well for me with a Debian target distro. If you should happen to get a key conflict, just delete or change the relevant key binding for this case.
At least with the latest VSCode, you can go to File -> Preferences -> Keyboard Shortcuts. On that page, there is a text under the search field: For advanced customizations open and edit keybindings.json. That will open you a view showing the default keybindings on the left and an empty file on the right for your own bindings. You can try to copy those bindings from Windows and save the to your Ubuntu one.
If you're not customizing your keymap, look through VSCode Keymaps for keymaps and install on both Windows and Ubuntu.
I personally use the code-settings-sync extension.
Synchronize Settings, Snippets, Themes, File Icons, Launch, Keybindings, Workspaces and Extensions Across Multiple Machines Using GitHub Gist.
I'm new to VSCode (Visual Studio Code) and I'm coming from WebStorm.
When I used WebStorm I was able to use Command + ` to swap instances of WebStorm windows. This behavior is also found in Chrome when you use that shortcut to switch between Chrome windows.
Is there a way to do this on VSCode?
Two options using VS Code:
The workbench.action.switchWindow keybinding to select the window to switch to. It is bound to ctrlw by default
The workbench.action.quickSwitchWindow command. Unlike workbench.action.switchWindow, it automatically switches windows when you release the keys. It is not bound by default but you can configure a keybinding for it.
The OS may also provide this:
Mac: cmd`
Windows
I run Mac OSX 10.9 (Mavricks) and use EmacsMac installed via macports package emacs-app-mac (emacs version 24.3.1). The GUI uses cmd as the meta key, which is what I want. But I also run the same binary (emacs points to Emacs -nw) in my iTerm2 terminal (Build 1.0.0.20131116), where meta-key is alt instead of cmd.
In iTerm preferences i've tried the different settings for "left option key acts as ..." but no joy there. Is there a way I can get emacs in iTerm to recognise cmd as my meta key?
Preferences -> Profiles -> Keys has what you want.
Mine is set to +Esc. I know, meta looks like what you want but it is not it.
Canopy's integrated Ipython terminal allows to use Emacs keybindings, but the integrated code editor won't. This is a problem when switching from one window to the other...
Is there a way to activate Emacs keybindings in "Enthought" Canopy code editor? (I am on OS X)