In your plugin add a Preferences.sublime-settings file and put all the plugins settings in it.
I recommend prefixing all the settings {PLUGIN}.. For example in phpunitkit all settings are prefixed phpunit..
{
// Enable composer support. If a composer installed PHPUnit is found then it is used to run tests.
"phpunit.composer": true,
// Enable the default keymaps.
"phpunit.keymaps": true,
// ...
}
See https://github.com/gerardroche/sublime-phpunit/blob/master/Preferences.sublime-settings
You can access all the settings in code.
window = sublime.active_window()
view = window.active_view()
settings = view.settings()
is_composer_enabled = view.settings().get('phpunit.composer')
See https://github.com/gerardroche/sublime-phpunit/blob/master/plugin.py#L18
Or anywhere else like keymaps.
{ "keys": [",", "."], "command": "phpunit_switch_file", "context": [{ "key": "setting.command_mode" }, { "key": "setting.phpunit.keymaps" }, { "key": "setting.phpunit.vi_keymaps" }] },
See https://github.com/gerardroche/sublime-phpunit/blob/master/Default%20(Linux).sublime-keymap
Setting preferences
1. User Preferences
Open: Menu > Preferences > Settings
File: User\Preferrences.sublime-settings
{
"phpunit.composer": true
}
1. Per-Project
Open: Menu > Project > Edit Projeect
File: Path\To\Project\Name.sublime-project
{
"settings": {
"phpunit.composer": true
}
}
Notice how we use the “settings” key in per-project settings. But the settings are still the same.