Code-settings-sync: Feature Request : Support OS specific key bindings in single file

Created on 14 Mar 2018  ·  16Comments  ·  Source: shanalikhan/code-settings-sync

The only issue I found where this functionality was mentioned in any way was #194 (all the way at the bottom).

I use a Mac at work but Linux at home. Right now every keyboard shortcut I add needs to be manually replicated across keybindings.json and keybindingsMac.json. I don't want shortcuts to be separated though. Instead, I want to have the option of storing all keyboard shortcuts in one file and have that synced across all my VSC instances, regardless of OS. I'd be happy to help with a PR (I am assuming there is no rush as there does not seem to be a great demand). If there are other solutions to my issue, please let me know. I really tried finding some info but maybe I am just not very creative ;)

I would imagine something like sync.universalKeybindings: true or sync.separateKeybindings: false 🤷‍♂️

PR-Welcome ✨ feature-request 💡 fixed

Most helpful comment

This scenario interests me as well, I have common keybindings that I want to share between both OS (alt+q to reflow paragraph).

Also since version 1.27 (August 2018), vscode supports platform specific bindings with isLinux, isMac and isWindows in the when clause:

{
  "key": "ctrl+o",
  "command": "workbench.action.files.openFolder",
  "when": "!isMac"
},
{
  "key": "cmd+o",
  "command": "workbench.action.files.openFolder",
  "when": "isMac"
}

All 16 comments

Why do you want to keep Mac keybindings and Windows keybindings in same file?
What the scenario. ?
Would it work if you use Mac key commands in windows keybindings instead ? Wont code mark them as error.

Closing this issue.
Let me know i will reopen it.

Sorry I went on holidays and forgot about this. The reason for this is that if I e.g., download a plugin and define a keyboard shortcut for it, I want this shortcut to be synced to both my Linux machine at home and my MBP at work without having to copy & paste the shortcut from keybindingsMac.json to keybindings.json.

Right now I need to manually keep both keybindings files in sync.

It would be great if u can help me produce the scenario for you
Which extension and shortcuts which will behave same for mac and windows ?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Florian Beeres notifications@github.com
Sent: Monday, March 26, 2018 1:56:55 PM
To: shanalikhan/code-settings-sync
Cc: Shan Khan; State change
Subject: Re: [shanalikhan/code-settings-sync] Suggestion: add option to disable OS specific keybindings (#515)

Sorry I went on holidays and forgot about this. The reason for this is that if I e.g., download a plugin and define a keyboard shortcut for it, I want this shortcut to be synced to both my Linux machine at home and my MBP at work without having to copy & paste the shortcut from keybindingsMac.json to keybindings.json.

Right now I need to manually keep both keybindings files in sync.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHubhttps://github.com/shanalikhan/code-settings-sync/issues/515#issuecomment-376094458, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXjnLHUHovtL49-oP8uurTqGnlF4-ITks5tiK1XgaJpZM4SqDMC.

For example, I have this keybinding on Linux

    {
        "key": "ctrl+k tab",
        "command": "workbench.action.openRecent",
    },

and this on mac

    {
        "key": "cmd+k tab",
        "command": "workbench.action.openRecent",
    },

Right now I copy & paste the keybinding from one file to the other when I create it. I could also just have both in the same file (more convenient). Maybe copy & pasting is really an okay option here.

Would also want this behaviour. There also are keybindings that don't use OS specific keys that would benefit from this. Using this functionality only confuses the users because it adds something to the settings that VS Code doesn't do.

This scenario interests me as well, I have common keybindings that I want to share between both OS (alt+q to reflow paragraph).

Also since version 1.27 (August 2018), vscode supports platform specific bindings with isLinux, isMac and isWindows in the when clause:

{
  "key": "ctrl+o",
  "command": "workbench.action.files.openFolder",
  "when": "!isMac"
},
{
  "key": "cmd+o",
  "command": "workbench.action.files.openFolder",
  "when": "isMac"
}

Agree with @cbliard

Since v1.27, VSCode support OS specific key bindings now. And it'll be great to keep all the bindings in one file and sync them together.

Feel free to send a PR.

I would imagine something like sync.universalKeybindings: true or sync.separateKeybindings: false man_shrugging

I would recommend it to keep this config a part of Setting Sync Global Setting instead of env. setting.

I would recommend it to keep this config a part of Setting Sync Global Setting instead of env. setting.

@shanalikhan are you saying you want a setting like sync.universalKeybindings: true or no?

Yes a setting like this. But not in settings.json instead in Global Settings json file.

I'm talking about adding a key in Settings Sync Global Settings that is shared across multiple Gist.
Read here:

https://github.com/shanalikhan/code-settings-sync#settings

Wanted to throw my support in for this feature request -- I only have a few keybindings, and none of them are OS-specific, so it's annoying to have to copy and paste the keybindings file back and forth.

Wanted to throw my support in for this feature request

@amccaugh
Yes go ahead, PR is welcome. You need to create new configuration in Settings Sync Global Settings to use this method.
Will release new version

Hey guys, I have opened a PR #854 addressing this issue and some other features. We need some testers on macOS.

Features to be tested is

A new setting sync.universalKeybindings is introduced in Global Settings of Sync

Here is the expected behavior.

How to install extension with that patch

You can either

  1. Download and install this package
    OR
  2. Fetch Code from my repository and compile the package

1. Download and install this package

Download the compiled package from here.

And Install package using instructions given at https://stackoverflow.com/questions/37071388/how-to-install-vscode-extensions-offline

2. Fetch Code from my repository and compile the package

To Fetch Code:

git clone https://github.com/njkevlani/code-settings-sync && git checkout pragmaUtil-kb

To Compile the code:

npm install -g vsce
cd path/to/code-settings-sync/
vsce package

A file with name code-settings-sync-3.2.9.vsix will be created. This is the package that you would need to install in vscode.

To install the compiled package

https://stackoverflow.com/questions/37071388/how-to-install-vscode-extensions-offline

Thanks @njkevlani

I will release new version once the build by @njkevlani works for Mac users.

I have released new version of Settings Sync v3.3.0 fixing this issue. Im closing this ticket let me know if u guys run into some problem

Was this page helpful?
0 / 5 - 0 ratings