Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS Specific Keybindings #8962

Closed
erichiller opened this issue Jul 8, 2016 · 10 comments · Fixed by #54894
Closed

OS Specific Keybindings #8962

erichiller opened this issue Jul 8, 2016 · 10 comments · Fixed by #54894
Assignees
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@erichiller
Copy link

erichiller commented Jul 8, 2016

I have a company issued OSX machine, linux boxes and windows machines all of which I do dev work on, moving back and forth, I try to keep my settings in sync, it would be very nice to have an operating specific syntax for the keybindings file, much how tasks.json does.

{
    "version": "0.1.0",
    "windows": [
        {
            "key": "win+b",
            "command": "workbench.action.tasks.build"
        },{
            "key": "win+d",
            "command": "workbench.action.tasks.terminate"
        }
    ],
    "osx": [
        {
            "key": "cmd+b",
            "command": "workbench.action.tasks.build"
        },{
            "key": "cmd+d",
            "command": "workbench.action.tasks.terminate"
        }
    ]
}

Or better yet in line with #871 ...

{
    "windows": [
        {
            "key": "win+b",
            "command": [
                "workbench.action.tasks.terminate",
                "workbench.action.tasks.build"
            ]
        },{
            "key": "win+l",
            "command": "workbench.action.tasks.showLog"
        }
    ],
    "osx": [
        {
            "key": "cmd+b",
            "command": [
                "workbench.action.tasks.terminate",
                "workbench.action.tasks.build"
            ]
        },{
            "key": "cmd+l",
            "command": "workbench.action.tasks.showLog"
        }
    ]
}

For that matter it would be wonderful to have this ability for all of the user configurable settings

@alexdima
Copy link
Member

tasks.json is sitting in the workspace (presumably also checked in a git repo...), thus its need to support different values across different Operating Systems.

keybindings.json or settings.json are local to the user, since that's where more personal things should stay (i.e. not shared with the team).

I would personally not complicate the structure for the majority of users that don't need to jump across Operating Systems, I would go for something like keybindings.osx.json, keybindings.linux.json, settings.win.json, etc, which would overimpose the variants without the OS in their filename.

@bpasero @aeschli @jrieken - You are also heavy cross OS users and share the ownership of the config service. Thoughts?

@alexdima alexdima added the feature-request Request for new features or functionality label Jul 11, 2016
@bpasero bpasero added this to the Backlog milestone Jul 11, 2016
@aeschli aeschli removed their assignment Jul 25, 2016
@bpasero bpasero changed the title Operating Specific Keybindings OS Specific Keybindings Aug 14, 2016
@alexejk
Copy link

alexejk commented Nov 25, 2016

I'm hitting the same issue where I would like to sync my settings cross machines, including Windows and OSX machines. The only thing that currently is not working well for me is keybindings.
It would be great to provide an option in user-specific keybinds to set "this is only valid for Windows".

Instead of scoping all of the keybindings, I agree that it makes more sense to allow creation of user-specific keybindings per platform in different files (so besides normal keybindings.json) have something like keybindings.osx.json.

Just as a thought, another option is introducing a platform property in the keybind itself or ability to have when property handle platform, e.g osWinOnly or !osOSX` or something in this style. But I personally like the idea of platform files.

@alexdima alexdima added the keybindings VS Code keybinding issues label May 20, 2017
@bjornhanson
Copy link

bjornhanson commented Aug 21, 2017

I've been syncing my settings between Linux and OS X and am trying to resolve an issue where I'm loading custom CSS but the path picked up in the settings file by ~/ or $HOME don't seem to point to the same thing on the OS (might have to do with how I'm launching it in Linux). This might be something I can figure out, but in general I could see it being really nice to have any settings setup to be OS-specific, not just key bindings.

@repentsinner
Copy link

We've run into a similar issue with Python .venv support, where the pythonPath differs by OS but is otherwise seems sensible to store in the repo with other things that should be shared.

{
    // win
    "python.pythonPath": "${workspaceRoot}\\.venv\\Scripts\\python.exe",
    "python.formatting.provider": "yapf"
}

{
    // mac
    "python.pythonPath": "${workspaceRoot}/.venv/bin/python",
    "python.formatting.provider": "yapf"
}

Thanks for considering!

@Tyriar
Copy link
Member

Tyriar commented Apr 16, 2018

Here's my keybindings.json file, my dotfiles script symlinks that to the correct directory on each platform https://github.com/Tyriar/dotfiles/blob/master/modules/vscode/config/keybindings.json

Some of the keybindings don't make sense on mac in particular, for example this one which makes ctrl+k a chord on macOS:

{ "key": "ctrl+k ctrl+s",   "command": "workbench.action.openGlobalKeybindingsFile" },

Something like this would be sufficient for me without complicating the structure:

{ "key": "ctrl+k ctrl+s",   "command": "workbench.action.openGlobalKeybindingsFile",
  "when": "!isMac" },

@wavebeem
Copy link

wavebeem commented Apr 16, 2018 via email

@tcodes0
Copy link

tcodes0 commented Jul 22, 2018

I'd like for this feature to exist as well, mostly to integrate better with windows. I use vscode across Mac, Linux and Windows and my issue is with the git.path setting.

@gandalfsaxe
Copy link

Leaving settings.json as platform agnostic and making os-specific files that can be shared on all OSs for convenience, but only applied on their target platform seems like a good idea.

Tyriar added a commit that referenced this issue Jul 23, 2018
bpasero pushed a commit that referenced this issue Aug 7, 2018
@bpasero bpasero modified the milestones: Backlog, August 2018 Aug 7, 2018
@gandalfsaxe
Copy link

Good implementation. Thanks!

@Tyriar Tyriar added the verification-needed Verification of issue is requested label Aug 27, 2018
@jrieken jrieken added the verified Verification succeeded label Aug 28, 2018
@jrieken
Copy link
Member

jrieken commented Aug 28, 2018

verified via code review

Tyriar added a commit to microsoft/vscode-docs that referenced this issue Sep 4, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

13 participants