Python sublime.save_settings() Examples

The following are 30 code examples of sublime.save_settings(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: TabNine.py    From tabnine-sublime with MIT License 6 votes vote down vote up
def __init__(self):
        self.before = ""
        self.after = ""
        self.region_includes_beginning = False
        self.region_includes_end = False
        self.before_begin_location = 0
        self.autocompleting = False
        self.choices = []
        self.substitute_interval = 0, 0
        self.actions_since_completion = 1
        self.old_prefix = None
        self.popup_is_ours = False
        self.seen_changes = False
        self.no_hide_until = time.time()
        self.just_pressed_tab = False
        self.tab_only = False

        self.tab_index = 0
        self.old_prefix = None
        self.expected_prefix = ""
        self.user_message = []

        sublime.load_settings(PREFERENCES_PATH).set('auto_complete', False)
        sublime.save_settings(PREFERENCES_PATH) 
Example #2
Source File: dired.py    From dired with MIT License 6 votes vote down vote up
def run(self, edit, dirs):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()
        for path in dirs :
            bm.append(path)
            settings.set('bookmarks', bm)

            # This command makes/writes a sublime-settings file at Packages/User/,
            # and doesn't write into one at Packages/dired/.
            sublime.save_settings('dired.sublime-settings')

            sublime.status_message('Bookmarking succeeded.')
            self.view.erase_regions('marked') 
Example #3
Source File: dired.py    From dired with MIT License 6 votes vote down vote up
def run(self, edit):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()

        def on_done(select) :
            if not select == -1 :
                bm.pop(select)
                sublime.status_message('Remove selected bookmark.')
                settings.set('bookmarks', bm)
                sublime.save_settings('dired.sublime-settings')

        self.view.window().show_quick_panel(bm, on_done) 
Example #4
Source File: hound.py    From SublimeHound with MIT License 6 votes vote down vote up
def run(self, edit):
        self.settings = sublime.load_settings(SETTINGS)
        self.hound_url = self.settings.get("hound_url").rstrip("/")
        self.github_base_url = self.settings.get("github_base_url")
        self.exclude_repos = set(self.settings.get("exclude_repos", []))
        self.custom_headers = self.settings.get("custom_headers", {})
        self.debug = self.settings.get("debug", False)
        if self.debug:
            logger.setLevel(logging.DEBUG)
            http.client.HTTPConnection.debuglevel = 1
        else:
            http.client.HTTPConnection.debuglevel = 0

        if self.hound_url == "" or self.github_base_url == "":
            self.settings.set("hound_url", self.hound_url)
            self.settings.set("github_base_url", self.github_base_url)
            sublime.save_settings(self.SETTINGS)  # save them so we have something to edit
            sublime.error_message("Please set your hound_url and github_base_url.")
            self.open_settings()
            return 
Example #5
Source File: listener.py    From network_tech with Apache License 2.0 6 votes vote down vote up
def run(self, edit):
        settings = sublime.load_settings(SETTINGS_FILE_NAME)
        network_info_on_hover = settings.get(NETWORK_INFO_ON_HOVER_SETTING_NAME, True)
        print(network_info_on_hover)
        settings.set(NETWORK_INFO_ON_HOVER_SETTING_NAME, not network_info_on_hover)
        sublime.save_settings(SETTINGS_FILE_NAME)

        setting_status = 'ON' if not network_info_on_hover else 'OFF'
        set_status = 'Network Info Popup: {}'.format(setting_status)

        def clear_status():
            current_status = self.view.get_status(STATUS_KEY)
            if set_status == current_status:
                self.view.erase_status(STATUS_KEY)

        self.view.set_status(STATUS_KEY, set_status)
        sublime.set_timeout_async(clear_status, 4000) 
Example #6
Source File: dired_file_operations.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, cut=False):
        self.index = self.get_all()
        filenames = self.get_marked(full=True) or self.get_selected(parent=False, full=True)
        if not filenames:
            return sublime.status_message('Nothing chosen')
        settings  = sublime.load_settings('dired.sublime-settings')
        copy_list = settings.get('dired_to_copy', [])
        cut_list  = settings.get('dired_to_move', [])
        # copied item shall not be added into cut list, and vice versa
        for f in filenames:
            if cut:
                if not f in copy_list:
                    cut_list.append(f)
            else:
                if not f in cut_list:
                    copy_list.append(f)
        settings.set('dired_to_move', list(set(cut_list)))
        settings.set('dired_to_copy', list(set(copy_list)))
        sublime.save_settings('dired.sublime-settings')
        self.show_hidden = self.view.settings().get('dired_show_hidden_files', True)
        self.set_status() 
Example #7
Source File: ksp_plugin.py    From SublimeKSP with GNU General Public License v3.0 6 votes vote down vote up
def run(self, setting, default):
        sksp_options_dict = {
            "ksp_compact_output" : "Remove Indents and Empty Lines",
            "ksp_compact_variables" : "Compact Variables",
            "ksp_extra_checks" : "Extra Syntax Checks",
            "ksp_optimize_code" : "Optimize Compiled Code",
            "ksp_signal_empty_ifcase" : "Raise Error on Empty 'if' or 'case' Statements",
            "ksp_add_compiled_date" : "Add Compilation Date/Time Comment",
            "ksp_comment_inline_functions" : "Insert Comments When Expanding Functions",
            "ksp_play_sound" : "Play Sound When Compilation Finishes"
        }

        s = sublime.load_settings("KSP.sublime-settings")
        s.set(setting, not s.get(setting, False))
        sublime.save_settings("KSP.sublime-settings")

        if s.get(setting, False):
            option_toggle = "enabled!"
        else:
            option_toggle = "disabled!"

        sublime.status_message('SublimeKSP option %s is %s' % (sksp_options_dict[setting], option_toggle)) 
Example #8
Source File: config.py    From sublime-boxy-theme with MIT License 6 votes vote down vote up
def on_navigate(self, href):
        if href.startswith('back'):
            self.show_popup(href[5:])
        else:
            settings = sublime.load_settings('Preferences.sublime-settings')
            name, value, section = href.split(':')
            if name:
                if name not in ('theme', 'color_scheme'):
                    boolean = True if value == 'True' else False
                    if boolean:
                        settings.set(name, boolean)
                    else:
                        settings.erase(name)
                else:
                    settings.set(name, value)
                sublime.save_settings('Preferences.sublime-settings')

            self.show_popup(section) 
Example #9
Source File: PyYapf.py    From PyYapf with Apache License 2.0 6 votes vote down vote up
def find_yapf(self):
        """Find the yapf executable."""
        # default to what is in the settings file
        cmd = self.get_setting("yapf_command")
        cmd = os.path.expanduser(cmd)
        cmd = sublime.expand_variables(
            cmd,
            sublime.active_window().extract_variables()
        )

        save_settings = not cmd

        for maybe_cmd in ['yapf', 'yapf3', 'yapf.exe', 'yapf3.exe']:
            if not cmd:
                cmd = which(maybe_cmd)
            if cmd:
                self.debug('Found yapf: %s', cmd)
                break

        if cmd and save_settings:
            settings = sublime.load_settings(PLUGIN_SETTINGS_FILE)
            settings.set("yapf_command", cmd)
            sublime.save_settings(PLUGIN_SETTINGS_FILE)

        return cmd 
Example #10
Source File: pico_setup_path.py    From sublime-PICO-8 with MIT License 6 votes vote down vote up
def run(self, edit):
		def done(path):
			settings = sublime.load_settings("PICO-8.sublime-settings")
			settings.set("pico-8_path", path)
			sublime.save_settings("PICO-8.sublime-settings")
			return

		platform = sublime.platform()
		if platform == "linux":
			self.view.window().show_input_panel("PICO-8 Path", "/path/to/pico8", done, None, None)
		elif platform == "osx":
			self.view.window().show_input_panel("PICO-8 Path", "/path/to/PICO-8.app/Contents/MacOS/pico8", done, None, None)
		elif platform == "windows":
			self.view.window().show_input_panel("PICO-8 Path", "C:\\Program Files (x86)\\PICO-8\\pico8.exe", done, None, None)
		else:
			sublime.error_message("Error: could not resolve platform\n\n[\"linux\", \"osx\", \"windows\"]")
			return 
Example #11
Source File: VulHint.py    From VulHint with MIT License 5 votes vote down vote up
def run(self, edit):
         sublime.load_settings("plugin.sublime-settings").set("enable", 1)
         sublime.save_settings("plugin.sublime-settings") 
Example #12
Source File: color_helper_util.py    From ColorHelper with MIT License 5 votes vote down vote up
def save_palettes(palettes, favs=False):
    """Save palettes."""

    s = sublime.load_settings('color_helper.palettes')
    if favs:
        s.set('favorites', palettes)
    else:
        s.set('palettes', palettes)
    sublime.save_settings('color_helper.palettes') 
Example #13
Source File: VulHint.py    From VulHint with MIT License 5 votes vote down vote up
def run(self, edit):
         sublime.load_settings("plugin.sublime-settings").set("enable", 0)
         sublime.save_settings("plugin.sublime-settings") 
Example #14
Source File: commit_skipping.py    From st3-gitblame with MIT License 5 votes vote down vote up
def run(self, edit, mode, permanence):
        if permanence:
            sublime.load_settings(SETTINGS_FILE_BASENAME).set(
                SETTINGS_KEY_COMMIT_SKIPPING_MODE, mode
            )
            sublime.save_settings(SETTINGS_FILE_BASENAME)
            self.view.settings().erase(SETTINGS_KEY_TEMPORARY_COMMIT_SKIPPING_MODE)
        else:
            self.view.settings().set(SETTINGS_KEY_TEMPORARY_COMMIT_SKIPPING_MODE, mode) 
Example #15
Source File: base.py    From sublime-elasticsearch-client with MIT License 5 votes vote down vote up
def save_settings(self):
        self.settings.save()
        self.init_client() 
Example #16
Source File: base.py    From sublime-elasticsearch-client with MIT License 5 votes vote down vote up
def save(self):
        sublime.save_settings(self.SETTINGS_FILE) 
Example #17
Source File: runInIndesign.py    From RunInIndesign with MIT License 5 votes vote down vote up
def targetSel(self,index):
		sett=sublime.load_settings('RunInIndesign.sublime-settings')
		available=[it['identifier'] for it in sett.get('available')][index]
		sett.set('target',available)
		sublime.save_settings('RunInIndesign.sublime-settings') 
Example #18
Source File: settings.py    From LSP with MIT License 5 votes vote down vote up
def _set_enabled(self, config_name: str, is_enabled: bool) -> None:
        if _settings_obj:
            client_settings = self._global_settings.setdefault(config_name, {})
            client_settings["enabled"] = is_enabled
            _settings_obj.set("clients", self._global_settings)
            sublime.save_settings("LSP.sublime-settings") 
Example #19
Source File: settings.py    From Fuse.SublimePlugin with MIT License 5 votes vote down vote up
def setSetting(key,value):
	s = sublime.load_settings("Fuse.sublime-settings")
	s.set(key, value)
	sublime.save_settings("Fuse.sublime-settings") 
Example #20
Source File: theme.py    From Terminus with MIT License 5 votes vote down vote up
def run(self, theme=None):
        if not self.themefiles:
            self.themefiles = list(self.get_theme_files())

        if theme:
            if theme not in ["default", "user"]:
                if theme + ".json" not in self.themefiles:
                    raise IOError("Theme '{}' not found".format(theme))
            settings = sublime.load_settings("Terminus.sublime-settings")
            settings.set("theme", theme)
            sublime.save_settings("Terminus.sublime-settings")

        else:
            self.themes = ["default", "user"] + \
                sorted([f.replace(".json", "") for f in self.themefiles])
            settings = sublime.load_settings("Terminus.sublime-settings")
            self.original_theme = settings.get("theme", "default")
            try:
                selected_index = self.themes.index(self.original_theme)
            except Exception:
                selected_index = 0
            self.window.show_quick_panel(
                self.themes,
                self.on_selection,
                selected_index=selected_index,
                on_highlight=lambda x: sublime.set_timeout_async(lambda: self.on_selection(x))) 
Example #21
Source File: docphp.py    From docphp with MIT License 5 votes vote down vote up
def plugin_unloaded():
    for k in openfiles:
        try:
            openfiles[k].close()
        except Exception as e:
            if getSetting('debug'):
                print(e)
    sublime.save_settings(setting_file)

    from package_control import events

    if events.remove(package_name):
        if os.path.isdir(getDocphpPath()):
            shutil.rmtree(getDocphpPath()) 
Example #22
Source File: docphp.py    From docphp with MIT License 5 votes vote down vote up
def setSetting(key, value):
    currentSettings.set(key, value)
    sublime.save_settings(setting_file) 
Example #23
Source File: Agila.py    From Agila-Theme with MIT License 5 votes vote down vote up
def on_done(self, index):
        theme = self.themes[index] + '.sublime-theme'
        self.set_scheme(self.schemes[index])
        self.set_theme(theme)
        self.save_settings(theme) 
Example #24
Source File: Agila.py    From Agila-Theme with MIT License 5 votes vote down vote up
def save_settings(self, theme):
        sublime.save_settings('Preferences.sublime-settings')
        sublime.status_message('Agila Theme: ' + theme)
        print('')
        print('[Agila Theme] ' +  theme)
        print('') 
Example #25
Source File: swap_server.py    From omnisharp-sublime with MIT License 5 votes vote down vote up
def cb(self, index):
        settings = sublime.load_settings('OmniSharpSublime.sublime-settings')
        settings.set("omnisharp_server_active", self.list[index])
        print(settings)
        sublime.save_settings('OmniSharpSublime.sublime-settings')

        omnisharp.restart_omnisharp_server_subprocess(helpers.active_view()) 
Example #26
Source File: settings.py    From SendCode with MIT License 5 votes vote down vote up
def set(self, key, value):
        syntax = self.syntax()

        window = sublime.active_window()
        if window:
            project_data = window.project_data() or {}
            project_settings = project_data.get("settings", {}).get("SendCode", {})

            if key == "prog" and key in project_settings:
                project_settings[key] = value

            if syntax:
                syntax_settings = project_settings.get(syntax, {})
                if key in syntax_settings:
                    syntax_settings[key] = value
                    window.set_project_data(project_data)
                    return
            if key in project_settings:
                project_settings[key] = value
                window.set_project_data(project_data)
                return

        #  check syntax settings
        if key == "prog":
            self.s.set(key, value)

        if syntax:
            syntax_settings = self.s.get(syntax, {})
            syntax_settings[key] = value
            self.s.set(syntax, syntax_settings)
        else:
            self.s.set(key, value)

        sublime.save_settings('SendCode.sublime-settings') 
Example #27
Source File: Localization.py    From Chinese-Localization with MIT License 5 votes vote down vote up
def restore_setting(name, value):
    config = sublime.load_settings(CONFIG_NAME)
    config.set(name, value)
    sublime.save_settings(CONFIG_NAME) 
Example #28
Source File: standard-format.py    From sublime-standard-format with MIT License 5 votes vote down vote up
def run(self, edit):
        if settings.get('format_on_save', False):
            settings.set('format_on_save', False)
            sublime.status_message("Format on save: Off")
        else:
            settings.set('format_on_save', True)
            sublime.status_message("Format on save: On")
        sublime.save_settings(SETTINGS_FILE) 
Example #29
Source File: __init__.py    From tandem with Apache License 2.0 5 votes vote down vote up
def save(self):
        sublime.save_settings(self._name) 
Example #30
Source File: commands.py    From sublime-text-virtualenv with MIT License 5 votes vote down vote up
def save_settings():
    """Save plugin settings to disk."""
    sublime.save_settings(SETTINGS)