def run(self, edit, content, syntax_file, scroll_end, replace): panel = self.view panel.set_read_only(False) if replace: panel.replace(edit, sublime.Region(0, panel.size()), content) else: panel.insert(edit, panel.size(), content+'\n') panel.sel().clear() pst = panel.settings() pst.set("rulers", []) pst.set("fold_buttons", True) pst.set("fade_fold_buttons", False) pst.set("gutter", False) pst.set("line_numbers", False) if syntax_file: if syntax_file == 'GsDoc': panel.set_syntax_file(gs.tm_path('doc')) panel.run_command("fold_by_level", { "level": 1 }) else: panel.set_syntax_file(syntax_file) panel.set_read_only(True) if scroll_end: panel.show(panel.size())
def run(self, edit, wd=None): v = self.view vs = v.settings() if not wd: wd = vs.get('9o.wd', active_wd(win=v.window())) was_empty = v.size() == 0 s = '[ %s ] # \n' % gs.simple_fn(wd) if was_empty: v.insert( edit, 0, 'GoSublime %s 9o: type `help` for help and command documentation\n\n' % about.VERSION) if was_empty or v.substr(v.size() - 1) == '\n': v.insert(edit, v.size(), s) else: v.insert(edit, v.size(), '\n' + s) v.sel().clear() n = v.size() - 1 v.sel().add(sublime.Region(n, n)) vs.set("9o.wd", wd) vs.set("rulers", []) vs.set("fold_buttons", True) vs.set("fade_fold_buttons", False) vs.set("gutter", True) vs.set("margin", 0) # pad mostly so the completion menu shows on the first line vs.set("line_padding_top", 1) vs.set("line_padding_bottom", 1) vs.set("tab_size", 2) vs.set("word_wrap", True) vs.set("indent_subsequent_lines", True) vs.set("line_numbers", False) vs.set("auto_complete", True) vs.set("auto_complete_selector", "text") vs.set("highlight_line", True) vs.set("draw_indent_guides", True) vs.set("scroll_past_end", True) vs.set("indent_guide_options", ["draw_normal", "draw_active"]) vs.set("word_separators", "./\\()\"'-:,.;<>~!@#$%&*|+=[]{}`~?") color_scheme = gs.setting("9o_color_scheme", "") if color_scheme: if color_scheme == "default": vs.erase("color_scheme") else: vs.set("color_scheme", color_scheme) else: vs.set("color_scheme", "") v.set_syntax_file(gs.tm_path('9o')) if was_empty: v.show(0) else: v.show(v.size() - 1)
def run(self, edit, pkg_name, file_name): view = self.view view.set_name(file_name) view.set_syntax_file(gs.tm_path('go')) view.replace(edit, sublime.Region(0, view.size()), 'package %s\n' % pkg_name) view.sel().clear() view.sel().add(view.find(pkg_name, 0, sublime.LITERAL))
def run(self, edit, wd=None): v = self.view vs = v.settings() if not wd: wd = vs.get('9o.wd', active_wd(win=v.window())) was_empty = v.size() == 0 s = '[ %s ] # \n' % gs.simple_fn(wd) if was_empty: v.insert(edit, 0, 'GoSublime %s 9o: type `help` for help and command documentation\n\n' % about.VERSION) if was_empty or v.substr(v.size()-1) == '\n': v.insert(edit, v.size(), s) else: v.insert(edit, v.size(), '\n'+s) v.sel().clear() n = v.size()-1 v.sel().add(sublime.Region(n, n)) vs.set("9o.wd", wd) vs.set("rulers", []) vs.set("fold_buttons", True) vs.set("fade_fold_buttons", False) vs.set("gutter", True) vs.set("margin", 0) # pad mostly so the completion menu shows on the first line vs.set("line_padding_top", 1) vs.set("line_padding_bottom", 1) vs.set("tab_size", 2) vs.set("word_wrap", True) vs.set("indent_subsequent_lines", True) vs.set("line_numbers", False) vs.set("auto_complete", True) vs.set("auto_complete_selector", "text") vs.set("highlight_line", True) vs.set("draw_indent_guides", True) vs.set("scroll_past_end", True) vs.set("indent_guide_options", ["draw_normal", "draw_active"]) vs.set("word_separators", "./\\()\"'-:,.;<>~!@#$%&*|+=[]{}`~?") color_scheme = gs.setting("9o_color_scheme", "") if color_scheme: if color_scheme == "default": vs.erase("color_scheme") else: vs.set("color_scheme", color_scheme) else: vs.set("color_scheme", "") v.set_syntax_file(gs.tm_path('9o')) if was_empty: v.show(0) else: v.show(v.size()-1) os.chdir(wd)
def run(self, edit): msg = '\n'.join([ 'Sublime Text 2 is no longer supported by GoSublime'+ '', 'See https://github.com/DisposaBoy/GoSublime/blob/master/SUPPORT.md#sublime-text', '', 'If you have a *good* reason to not upgrade to Sublime Text 3,', 'discuss it here https://github.com/DisposaBoy/GoSublime/issues/689', '', ]) self.view.set_scratch(True) self.view.set_syntax_file(gs.tm_path('9o')) self.view.set_name('GoSublime no longer supports Sublime Text 2') self.view.insert(edit, 0, msg) self.view.set_read_only(True)
def do_set_gohtml_syntax(view): fn = view.file_name() xl = gs.setting('gohtml_extensions', []) if xl and fn and fn.lower().endswith(tuple(xl)): view.set_syntax_file(gs.tm_path('gohtml'))
def run(self, edit, wd=None): v = self.view vs = v.settings() if not wd: wd = vs.get('9o.wd', active_wd(win=v.window())) wd = gs.abspath(wd) was_empty = v.size() == 0 s = '[ %s ] # \n' % gs.simple_fn(wd).replace('#', '~') if was_empty: v.insert(edit, 0, 'GoSublime %s 9o: type `help` for help and command documentation\n\n%s' % (about.VERSION, s)) else: v.insert(edit, v.size(), '\n'+s) v.sel().clear() n = v.size()-1 v.sel().add(sublime.Region(n, n)) opts = { "rulers": [], "fold_buttons": True, "fade_fold_buttons": False, "gutter": True, "margin": 0, # pad mostly so the completion menu shows on the first line "line_padding_top": 1, "line_padding_bottom": 1, "tab_size": 2, "word_wrap": True, "indent_subsequent_lines": True, "line_numbers": False, "auto_complete": True, "auto_complete_selector": "text", "highlight_line": True, "draw_indent_guides": True, "scroll_past_end": True, "indent_guide_options": ["draw_normal", "draw_active"], "word_separators": WORD_SEPARATORS, } opts.update(cfg.nineo_settings) for opt in opts: vs.set(opt, opts[opt]) vs.set("9o", True) vs.set("9o.wd", wd) color_scheme = cfg.nineo_color_scheme if color_scheme: if color_scheme == "default": vs.erase("color_scheme") else: vs.set("color_scheme", color_scheme) else: vs.set("color_scheme", "") v.set_syntax_file(gs.tm_path('9o')) if was_empty: v.show(0) else: v.show(v.size()-1) os.chdir(wd)
def run(self, edit, wd=None): v = self.view vs = v.settings() if not wd: wd = vs.get('9o.wd', active_wd(win=v.window())) wd = gs.abspath(wd) was_empty = v.size() == 0 s = '[ %s ] # \n' % gs.simple_fn(wd).replace('#', '~') if was_empty: v.insert( edit, 0, 'GoSublime %s 9o: type `help` for help and command documentation\n\n%s' % (about.VERSION, s)) else: v.insert(edit, v.size(), '\n' + s) v.sel().clear() n = v.size() - 1 v.sel().add(sublime.Region(n, n)) opts = { "rulers": [], "fold_buttons": True, "fade_fold_buttons": False, "gutter": True, "margin": 0, # pad mostly so the completion menu shows on the first line "line_padding_top": 1, "line_padding_bottom": 1, "tab_size": 2, "word_wrap": True, "indent_subsequent_lines": True, "line_numbers": False, "auto_complete": True, "auto_complete_selector": "text", "highlight_line": True, "draw_indent_guides": True, "scroll_past_end": True, "indent_guide_options": ["draw_normal", "draw_active"], "word_separators": WORD_SEPARATORS, } opts.update(cfg.nineo_settings) for opt in opts: vs.set(opt, opts[opt]) vs.set("9o", True) vs.set("9o.wd", wd) color_scheme = cfg.nineo_color_scheme if color_scheme: if color_scheme == "default": vs.erase("color_scheme") else: vs.set("color_scheme", color_scheme) else: vs.set("color_scheme", "") v.set_syntax_file(gs.tm_path('9o')) if was_empty: v.show(0) else: v.show(v.size() - 1) os.chdir(wd)
def run(self, edit, wd=None): v = self.view vs = v.settings() if not wd: wd = vs.get("9o.wd", active_wd(win=v.window())) was_empty = v.size() == 0 s = "[ %s ] # \n" % gs.simple_fn(wd).replace("#", "~") if was_empty: v.insert( edit, 0, "GoSublime %s 9o: type `help` for help and command documentation\n\n" % about.VERSION, ) if was_empty or v.substr(v.size() - 1) == "\n": v.insert(edit, v.size(), s) else: v.insert(edit, v.size(), "\n" + s) v.sel().clear() n = v.size() - 1 v.sel().add(sublime.Region(n, n)) opts = { "rulers": [], "fold_buttons": True, "fade_fold_buttons": False, "gutter": True, "margin": 0, # pad mostly so the completion menu shows on the first line "line_padding_top": 1, "line_padding_bottom": 1, "tab_size": 2, "word_wrap": True, "indent_subsequent_lines": True, "line_numbers": False, "auto_complete": True, "auto_complete_selector": "text", "highlight_line": True, "draw_indent_guides": True, "scroll_past_end": True, "indent_guide_options": ["draw_normal", "draw_active"], "word_separators": "./\\()\"'-:,.;<>~!@#$%&*|+=[]{}`~?", } opts.update(gs.setting("9o_settings")) for opt in opts: vs.set(opt, opts[opt]) vs.set("9o", True) vs.set("9o.wd", wd) color_scheme = gs.setting("9o_color_scheme", "") if color_scheme: if color_scheme == "default": vs.erase("color_scheme") else: vs.set("color_scheme", color_scheme) else: vs.set("color_scheme", "") v.set_syntax_file(gs.tm_path("9o")) if was_empty: v.show(0) else: v.show(v.size() - 1) os.chdir(wd)