Skip to content

Commit

Permalink
Add plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
liushoukai committed Jan 11, 2023
1 parent 5c94fcf commit db03811
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[{
"id": "preferences",
"children": [{
"id": "package-settings",
"children": [{
"caption": "SublimeMate",
"children": [{
"caption": "Main",
"command": "sublime_mate"
}, {
"caption": "Help",
"command": "sublime_mate_open_help"
}, {
"caption": "File a bug",
"command": "sublime_mate_open_bug_file"
}, {
"caption": "What's new in v2.0?",
"command": "sublime_mate_open_release_notes"
}]
}]
}]
}]
45 changes: 45 additions & 0 deletions SublimeMate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import sys
import sublime
import sublime_plugin
from os.path import dirname
from sublime_plugin import TextCommand
from webbrowser import open_new_tab

sys.path.insert(0, dirname(__file__))


class SublimeMateCommand(TextCommand):
def run(self, edit):
self.view.insert(edit, 0, "Hello, World!")


class SublimeMateOpenHelpCommand(TextCommand):
def run(self, _):
view_readme()


class SublimeMateOpenBugFile(TextCommand):
def run(self, _):
file_bug()


class SublimeMateOpenReleaseNotes(TextCommand):
def run(self, _):
view_release_notes()

def file_bug():
"""Opens a new tab in the default browser at this plugin's repo"""
url = "https://github.com/liushoukai/SublimeMate/issues/new"
open_new_tab(url)


def view_readme():
"""Opens a new tab in the default browser at this plugin's repo"""
url = "https://github.com/liushoukai/SublimeMate/blob/master/README.md"
open_new_tab(url)


def view_release_notes():
"""Opens a new tab in the default browser at this plugin's repo"""
url = "https://github.com/liushoukai/SublimeMate/releases"
open_new_tab(url)

0 comments on commit db03811

Please sign in to comment.