How to set windows Visual Studio Code to Linux Shortcuts
macos - Changing VSCode keybindings on Ubuntu from linux-like to Mac-like - Stack Overflow
visual studio code - How to transfer VSCode key mapping on windows to ubuntu - Stack Overflow
Besides fast keyboard shortcuts, what's the fundamental advantage of Vim?
Videos
Hi, is there a quick and easy way to map all keyboard shortcuts on VS Code Windows to match Linux defaults.
I keep getting messed up between Linux and Windows when I switch machines.
Full disclosure
I am the author of Kinto.
You might be able to lessen your work by simply swapping the keymap out before creating new bindings, however if you use the terminal any at all on Ubuntu, or any linux distro, that mac illusion will quickly fade. Also the Cmd + arrow keys won't behave the same unless you create a custom keymap for it.
If you want to create less work for yourself then I would recommend using Kinto. It will handle applying the proper (and native) keymap by listening to what app you're currently using. It does not intercept keys pressed like Autokey or other 3rd party rebinding/remapping tools.
Kinto also provides a custom keymap for normal mac Cmd + arrow key behavior & now Alt + arrow key behavior as well.
https://github.com/rbreaves/kinto
** Update 6/16/20 **
Kinto now uses xkeysnail, it is simpler and python based. Also works on a lower udev input level. Easier to configure as well because all settings belong in a single python based file. You can use kinto or xkeysnail to do what you want.
https://github.com/mooz/xkeysnail
** Old XKB method explained below **
https://medium.com/@benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58f731817c0
Here's a Gist as well, if you just want to see what is at the heart of it all, it will not alternate your keymap when needed though. The Gist also does not include custom xkb keymap files that setup macOS style cursors/word-wise manipulations that use Cmd and the arrow keys.
https://gist.github.com/rbreaves/f4cf8a991eaeea893999964f5e83eebb
Edit: Following the advice of another member I will also include the actual content of the gist, since I can't realistically include all the code and files that went into creating Kinto. This gist and Kinto are identical aside from Kinto's ability to dynamically change your keymap and apply more custom keymaps specific to macOS behavior.
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
# Windows and Mac keyboards - Terminal Apps (Physical Alt is Super, Physical Super is Alt, Physical Ctrl is Ctrl)
setxkbmap -option;setxkbmap -option altwin:swap_alt_win
#
# If you want a systemd service and bash script to help toggle between
# GUI and Terminal applications then look at project Kinto.
# https://github.com/rbreaves/kinto
#
# Note: The above may not work for Chromebooks running Linux, please look
# at project Kinto for that.
#
# If anyone would like to contribute to the project then please do!
#
I believe you can edit the keybindings.json file located in the .config/Code/User/ directory to override the default keyboard shortcuts. That would not require you to edit it one by one.
I'd first get the default keyboard shortcuts file open. To do that, open the VS Code command pallete by going to:
View -> Command Pallete... (or by pressing
Ctrl + Shift + p)
This will open up a textbox where you can enter you command: Then type in something like Shortcuts File and it will list a matching option which should look like:
Open Keyboard Shortcuts File
Note that it's different from "Open Keyboard Shortcuts" which opens a UI to edit the shortcuts.
Once you select the above command, it should open up your keybindings in a split view, where the left hand pane will show you a read only default shortcuts file, and the right hand pane will show you the custom keyboard shortcut bindings. (which is empty by default). Should look like this:

Then copy everything from the left pane (default shortcuts) and paste it on the keybindings.json file (right hand pane).
Now you can do a search and replace which is faster than manually changing each shortcut.
Hope it helps!!
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.