How can I enable the "Open in Browser" command for other file types, such as xml and xhtml?
My apologies in advance if this is already answered elsewhere, I haven't been able to find it.
import sublime, sublimeplugin
import webbrowser
class OpenInBrowserCommand(sublimeplugin.TextCommand):
def run(self, view, args):
if view.fileName():
webbrowser.open_new_tab("file://" + view.fileName())
def isEnabled(self, view, args):
return view.fileName() and (view.fileName()[-5:] == ".html" or
view.fileName()[-4:] == ".htm" or
view.fileName()[-4:] == ".php")
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 2 guests