Sublime Forum

Keybindings in .sublime-project

#1

You can have build systems inside a .sublime-project file.
Same with settings.
This is very useful.

Is the same possible with keyboard shortcuts?

My use case:

I use SublimeREPL to get a live, auto-reloading Node console into ST.
With every project, I need to pass a different args object into the command that, among other things, specifies the path of the script for Node to execute.

Adding a ‘keybindings’:[ ] array into .sublime-project would be an elegant and logical way to solve it.

And since you’re already loading keybindings from several different .sublime-keymap files (default/user/plugin-specific), adding just another source perhaps is a feasible quick addition.

0 Likes

#2

You can create a keybinding with a context to check a setting, e.g. setting.custom.project.foo

    {
        "keys": ["ctrl+shift+h"], "command": "foo_bar",
        "context": [
            { "key": "setting.custom.project.foo", "operand": true },
        ],
    },

and create the setting "custom.project.foo": true for the project.

2 Likes