B
B
Bitter Sugar2015-11-29 20:12:41
Python
Bitter Sugar, 2015-11-29 20:12:41

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")

I use the following approach. But I can't find a way to save the settings. Maybe there is a way to get the name of the settings file itself?
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

1 answer(s)
A
Alexander Ruchkin, 2015-11-30
@f0xice

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 question

Ask a Question

731 491 924 answers to any question