Sublime Forum

Keymap context: plugin setting

#1

Hello everybody.

Does anybody happen to know, if it is possible to reference a plugin-specific setting in .sublime-keymap file as context? Currently, it is possible to reference a global setting, just like this:

    ...
    "context": 
      { "key": "setting.some_global_setting", "operator": "equal", "operand": true }
    ], 
    ...

Just wanted to ask if it is mandatory to create a global setting to reference it in keymap, instead of using plugin setting within plugin keymap.

0 Likes

#2

Uh, I’ve probably been totally unclear. By global setting I meant Defaults/Base File.sublime-settings and User/Base File.sublime-settings. By plugin (local) setting I meant something, which is present in MyPlugin/MyPlugin.sublime-settings and User/MyPlugin.sublime-settings.

The thing why I ask this, is that I have a plugin with a whole bunch of defaults. When an end-user wants to customize it, he/she creates a corresponding file in User/ directory and overrides separate settings, as usual. I want to reference one of these settings in keymap, but, as far as I see, I can only use something from Defaults(or User)/Base File.sublime-settings, but not MyPlugin(or User)/MyPlugin.sublime-settings. In this case, end-user would have to edit both User/Base File.sublime-settings and User/MyPlugin.sublime-settings to fully customize the plugin.

0 Likes

#3

There’s no inbuilt support for it, but you can add your own contexts via a plugin, via on_query_context.

0 Likes