Answer the question
In order to leave comments, you need to log in
How to save settings file "bla/bla/name.sublime-settings"?
Good day! I am writing a plug-in for Sublime Text 3.
The task is to get the settings from the current window , change them and save .
I know what you can get by the name. But this is very dreary - there is a whole hierarchy.
import sublime
one_settings = sublime.load_settings("Preferences.sublime-settings")
import sublime
window = sublime.active_window()
myView = window.active_view()
res = myView.settings()
res.set("font_size", new_size) # задаю параметр
Answer the question
In order to leave comments, you need to log in
I am sure that there is no such function, because it can be applied at different levels (at the level of the current view, at the language level, at the general settings level), and it is not clear what to choose by default. Those. the maintainer must explicitly indicate this. Considering that what is not in the User cannot be changed (via Python) (because it is updated automatically and everything flies, i.e. the default settings are on the conscience of plugin developers), the hierarchy becomes not so big: the current view, language or Preferences.
Those. you need to choose, based on some considerations, between '.sublime-settings' and 'Preferences.sublime-settings' (+ do not forget about os-specific ones), and save them through save_settings.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question