sublime text 3 浏览器中打开,怎么变成 localhost路径


如题,我已经设置好用快捷键打开文件,wamp也已经安装,但是快捷键打开也只是文件所在位置路径而不是localhost服务器路径,怎么才能变成localhost路径

localhost 浏览器 sublime-text

不老峰moku 9 years, 10 months ago

文件Packages/Default/open_in_browser.py:


 php


 import sublime, sublime_plugin
import webbrowser

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

Ts123 answered 9 years, 10 months ago

Your Answer