DSav
DSav

Reputation: 1003

VSCode - Importing keyboard shortcuts

I'm using VSCode on Windows and Ubuntu and I'd like to have the same keyboard shortcuts in both environment (saving my brain memory space for more useful stuff than hotkeys!). Is there a way to export the keyboard shortcut settings in one environment and import them in the other? Or any other way to uniformize them?

For example, auto-indent on Ubuntu is CTRL+SHIFT+I, whereas on Windows, it's ALT+SHIFT + F. I'd like to have the same for both.

Upvotes: 25

Views: 20975

Answers (4)

Muhammed Albarmavi
Muhammed Albarmavi

Reputation: 24406

you can use this extension Settings Sync this will sync extensions and complete User Folder that Contains

  1. Settings File
  2. Keybinding File
  3. Launch File
  4. Snippets Folder
  5. VSCode Extensions & Extensions Configurations
  6. Workspaces Folder

it will save all setting on Github gits then you will be able on other platforms to download that setting this will keep to vscode sync it looks like visual studio kind sync but so far the configuration for the first time need little of work but it's not a big deal at totally helpful extensions

extension features 🔥🔥

  1. Use your GitHub account token and Gist.
  2. Easy to Upload and Download on one click.
  3. Show a summary page at the end with details about config and extensions effected.
  4. Auto download Latest Settings on Startup. 🌟
  5. Auto upload Settings on file change. 🌟
  6. Share the Gist with other users and let them download your settings. 🌟
  7. Supports GitHub Enterprise
  8. Support pragmas with @sync keywords: host, os, and env are supported.
  9. GUI for changing settings / logging in
  10. Allows you to Sync any file across your machines.

Upload Your Settings

Press Shift + Alt + U (macOS: Shift + Option + U)

Type ">Sync" In Command Palette into order download / upload

When downloading or uploading for the first time, the welcome page will automatically open, where you can configure the Settings Sync.

Once you select to upload, after uploading the settings. You will see the Summary details with the list of each file and extensions uploaded.

Download your Settings

Press Shift + Alt + D (macOS: Shift + Option + D)

Type ">Sync" In Command Palette into order download / upload

When downloading or uploading for the first time, the welcome page will automatically open, where you can configure the Settings Sync.

Once you select download, after downloading. Settings Sync will display your Summary containing the list of each file and extension being downloaded.

A new popup will be opened to allow you to restart the code to apply the settings.

Reset Extension Settings

Select "> Sync : Reset Extension Settings" in the Command Palette to reset your settings

🚀🚀

so far this feature has been discussed on GitHub and a lot of people recommend Settings Sync extension, maybe in feature versions will has settings sync build in, you can check this open issue [Ideas] - Settings Sync Roadmap and this Provide support to synchronize settings across machines.

Upvotes: 6

Loi Nguyen Huynh
Loi Nguyen Huynh

Reputation: 9928

TL;DR; I think use Settings Sync like Muhammed Albarmavi's answer mentioned is the way to go, I used it myself to sync between Ubuntu and Windows.


However, I don't know if there's a difference in syncing from Linux to Macos. About Settings Sync, the idea is it uses Github Gist to store all the settings on the cloud, so that then you could use any machine to pull (download) from the cloud to replicate those settings on any new machine. With the extension, you just need to press upload/download, all the copying process is done by the extension for you.

Details about those files store on gist, they're:

As you can see, there're keybindings.json and keybindingsMac.json, I would guess keybindings.json is for linux and windows, and keybindingsMac.json is for Macos, the other settings (like extensions settings) would be the same. So I myself keep syncing between Ubuntu and Windows by changing the same file keybindings.json. About syncing from Linux to MacOs, I don't know exactly what's happening under the hood, give a look at a comment here maybe you'll know. But the exactly what's happening under the hood seems to be not very important because it's taken care of by the Settings Sync itself already, so you might just try pressing upload and download, and see the changes happen.

As you use the Settings Sync, you'll notice that you can have multiple gists, so you can have multiple versions of settings on the cloud. Maybe you'd want some gist for Windows, some for Linux/macOS or any strategy that you could think of.

But if you want the exact same settings from the default ones to the modified ones syncing across the machines, I think that might not how it could work. But think, for example, to duplicate a line of code (copy-lines-down-action), the default key-shortcut would be Ctrl+Alt+Shift+↓, and it works well on Windows, but not on Ubuntu because Ctrl+Alt+Shift+↓ is also the default shortcut for moving between workspaces of the OS, so it'll not work on Ubuntu. The point is, the different OS is different, so you might not just copying the exact same settings from an OS to another and hope it'll work perfectly the same too easily. But I promise, using Settings Sync would not be that very painful, just a little tweak of OS-difference settings along the way, then you'll be happy.

If you haven't known how to use Settings Sync yet, I suggest just watch a youtube video, a medium article and/or the documentation. Still, it'll be fairly easy.

If there's a better way to sync perfectly exact settings from an OS to another btw, I would be curious to learn.

Upvotes: 2

Amogh Jahagirdar
Amogh Jahagirdar

Reputation: 559

If you want to import key bindings from other code editors like Atom or Sublime, there are plugins which you can directly install and start using. Hope that helped :)

Upvotes: 1

Scott McPeak
Scott McPeak

Reputation: 12739

As an answer to a similar question, I made a VSCode extension that provides the default Windows keybindings on any platform. It is on the VSCode extension marketplace, and called Windows Default Keybindings.

If you're happy with the Windows defaults, that should do what you want.

If you want a different platform's bindings (Linux or Mac), you could use the same procedure I did to make that extension, namely, run "Preferences: Open Default Keyboard Shortcuts (JSON)" and stuff the result into the appropriate place in package.json in a new extension.

Upvotes: 3

Related Questions