Sublime Forum

[Question] Is it possible to rewrite User\Preferences.sublime-settings file?

#1

1. Briefly

I have Preferences.sublime-settings file in my theme package. Is it possible, if user install my package, that my sublime-settings file to rewrite User\Preferences.sublime-settings file?

2. Detail

For example, user have User\Preferences.sublime-settings file:

{
    "highlight_line": false,
    "highlight_modified_tabs": false,
}

User install my package, where I set:

{
    "highlight_line": true,
    "highlight_modified_tabs": true,
}

Is it possible, that Package.sublime-settings > User\Preferences.sublime-settings; lines and modified tabs highlight for user, despite false value in a User\Preferences.sublime-settings?

3. Did not help

  1. I read documentation, but I don’t find Packages/<package>/<package>.sublime-settings item, only Packages/<syntax>/<syntax>.sublime-settings item, but my package is not a syntax.
  2. I try to add in my package settings, rewrite User\Preferences.sublime-settings file settings, → no effect for me.

Thanks.

0 Likes

#2

If you can’t treat your package as a syntax, then you need to change the Buffer preferences, the last item in the preference hierarchy in the documentation you referenced.

Personally, I think a plugin changing a user’s global preferences is obnoxious and should be avoided. If your plugin outputs to a buffer, or operates on a particular buffer then it makes sense to just change the preferences there.

2 Likes

#3

I have defined on practice. For example, in my package I have a setting:

"caret_style: wide"

For example, user Kristina install my package.

  • If Kristina don’t have caret_style parameter in Her User\Preferences.sublime-settings file, "caret_style": "wide" enabled for Kristina.
  • But if Kristina have caret_style in Her User\Preferences.sublime-settings file "caret_style": "blink", blink value was enabled for her.

Thus, order such:

...
2. Packages/Default/Preferences (<platform>).sublime-settings
3. Packages/<package>/Preferences.sublime-settings
4. Packages/User/Preferences.sublime-settings
5. <Project Settings>
...

May I make a pull request in a Sublime Text 3 documentation (not unofficial documentation)?

Thanks.

0 Likes

#4

Your observations appear to be correct.

The official documentation is not open source and you can not submit pull requests to it. The information is already included in the unofficial one too.

2 Likes