Closed excetara2 closed 7 years ago
Yes the issues you filed do point in this direction.
I'm reading sublime's settings stuff but I'm not sure I get it. So I can just read from eg. foo.sublime-settings?
I also do not know so much about settings as I've never completely written my own package but I was looking at this plugin which I was modifying today. I think the settings manager is because each window has it's own settings which you seem to do also with the build option to disable per window. That is all internal though and the external settings are set in the sublime.load_settings(
. Actually seems pretty simple.
class SettingsManager:
def get(key, default = None):
global_settings = sublime.load_settings('sublemacspro.sublime-settings')
settings = sublime.active_window().active_view().settings()
return settings.get(key, global_settings.get(key, default))
Then in the called code:
separators = SettingsManager.get("sbp_word_separators", default_sbp_word_separators)
Yup I have been looking at how other plugins to this too.
Have a look at the 'next' branch. Settings now start with org.rctay.buildview.
. See if you can "globally" disable this plugin via
"org.rctay.buildview.enabled": false
in your Preferences.sublime-settings
, or"enabled": false
in org.rctay.buildview.sublime-settings
and then enable it
"org.rctay.buildview.enabled": true
under the settings
key of your .sublime-project
.This what you were trying to do in #19 right? Globally disable but enable only for one view/project. Take it for a spin and let me know if it works.
May I suggest using something like BuildViewHistory or BuildViewBuffer?? If you look at all the settings files most are in the AllCapsFormat.sublime-settings. Then for the per project settings have a dictionary that contains all the relevant keys. This format just looks a lot cleaner to me but I guess it is up to you:
"buildviewhistory": {
"enabled": false,
}
The main one I have set in the current project that has per project settings is todoreview
:
"settings":
{
"TEXroot": "manuscript.tex",
"detect_indentation": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"use_tab_stops": true,
"todoreview": {
"exclude_folders": [
"*.git*"
],
"exclude_files": [
"*.log", "*.aux", "*.toc"
],
}
}
so this is an example just so you know what I mean and the user settings file in the user folder is TodoReview.sublime-settings
.
Anyways I'll actually checkout the next branch tomorrow. But seems yes this should solve #19 and thanks for the good work!!
Have a look at master, you can now do this, because we respect the settings hierarchy so you can have, say, project-specific settings. Note I did not go with the approach of grouping the plugin's settings in a dictionary though it looks very nice, because sublime unfortunately does not merge keys through the settings hierarchy; see the readme's known issues/TODO for details.
I think this is much better than sticking everything in the default users settings file. Could even then store in here to remember the preference for specific windows across sessions