写一个Python文件 可以完美解决
进入到“Preference”-> “Setting-User” 编写文件写入以下内容
import sublime, sublime_plugin
import webbrowser
url_map = {
'D:\wamp\www' : 'http://localhost',
}
class OpenBrowserCommand(sublime_plugin.TextCommand):
def run(self,edit):
window = sublime.active_window()
window.run_command('save')
url = self.view.file_name()
flag = False
for path, domain in url_map.items():
if url.startswith(path):
url = url.replace(path, domain)
flag = True
break
if not flag:
url = 'file://' + url
webbrowser.open_new(url)
保存为open_broswer.py