Sublime Forum

Get settings only once

#1

In plugin how I can access settings object only once and after use it?
Is it correctly code?

class MyPluginEventListener(sublime_plugin.EventListener):
	platform = sublime.platform().title()
	settings = sublime.load_settings('MyPlugin ('+platform+').sublime-settings')

	def on_post_save(self, view):
            val = self.settings.get('val')
            print(val)

In some times val is None. Why?

0 Likes

#2

Actually val is None on startup

0 Likes

#3

I made a writeup a while back explaining how settings work, it may help you: viewtopic.php?f=6&t=9076#p36601

Do not include the platform, Sublime does that automatically.

0 Likes