回覆列表
  • 1 # ngdzh12347

      Open In Browser 只能使用預設瀏覽器開啟,你可以看看它的程式碼:  Packages/Default/open_in_browser.py:  import sublime, sublime_pluginimport webbrowserclass OpenInBrowserCommand(sublime_plugin.TextCommand): def run(self, edit): if self.view.file_name(): webbrowser.open_new_tab("file://" + self.view.file_name()) def is_visible(self): return self.view.file_name() and (self.view.file_name()[-5:] == ".html" or self.view.file_name()[-5:] == ".HTML" or self.view.file_name()[-4:] == ".htm" or self.view.file_name()[-4:] == ".HTM")  你可以另外寫個外掛提供相應功能。要右鍵選單,需要加個 Context.sublime-menu。查考 Packages/Default/Context.sublime-menu 的實現。  關鍵程式碼供你參考(從我某個外掛摳出來的,不完整):  # 在OSX下使用Firefox開啟瀏覽器# browser_command = ["open", "-a", "firefox", "{url}"]# url = "blahblahblah"browser_command = [ os.path.expandvars(arg).format(url=url) for arg in setting.browser_command] if os.name == "nt": # unicode arguments broken under windows encoding = locale.getpreferredencoding() browser_command = [arg.encode(encoding) for arg in browser_command]subprocess.Popen(browser_command)

  • 中秋節和大豐收的關聯?
  • 電腦要接收紅外線需要安裝那些軟體?