Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add new commands to menu and command list

Context menu: remove "get list" command, as it's available in command
palette and main menu.

Added new gist view commands: rename file, change gist description,
delete file, delete gist. Commands themselves are not implemented yet.

Main menu: split the Gist submenu into two logical blocks - commands
that are always enabled (create gist/open gist) and gist view commands.
  • Loading branch information...
commit bda36371777ad5d1d1f2d8043e94c9eed7f2d9d0 1 parent c948a3e
@technocoreai technocoreai authored
View
5 Context.sublime-menu
@@ -1,5 +1,4 @@
[
- { "command": "gist", "caption": "Create Public Gist" },
- { "command": "gist_private", "caption": "Create Private Gist" },
- { "command": "gist_list", "caption": "Get Gist List" }
+ { "command": "gist", "caption": "Create Public Gist…" },
+ { "command": "gist_private", "caption": "Create Private Gist…" }
]
View
24 Gist.sublime-commands
@@ -1,13 +1,17 @@
[
{
- "caption": "Gist (public): Create from Selected Text",
+ "caption": "Gist: Create Public Gist",
"command": "gist"
},
{
- "caption": "Gist (private): Create from Selected Text",
+ "caption": "Gist: Create Private Gist",
"command": "gist_private"
},
{
+ "caption": "Gist: Open Gist",
+ "command": "gist_list"
+ },
+ {
"caption": "Gist: Copy Gist URL",
"command": "gist_copy_url"
},
@@ -20,7 +24,19 @@
"command": "gist_update"
},
{
- "caption": "Gist: Get List",
- "command": "gist_list"
+ "caption": "Gist: Rename File",
+ "command": "gist_rename_file"
+ },
+ {
+ "caption": "Gist: Change Gist Description",
+ "command": "gist_rename"
+ },
+ {
+ "caption": "Gist: Delete Gist File",
+ "command": "gist_delete_file"
+ },
+ {
+ "caption": "Gist: Delete Gist",
+ "command": "gist_delete"
}
]
View
10 Main.sublime-menu
@@ -9,12 +9,16 @@
"caption": "Gist",
"children":
[
- { "command": "gist", "caption": "Create Public Gist" },
- { "command": "gist_private", "caption": "Create Private Gist" },
+ { "command": "gist", "caption": "Create Public Gist…" },
+ { "command": "gist_private", "caption": "Create Private Gist…" },
+ { "command": "gist_list", "caption": "Open Gist…" },
+ { "caption": "-" },
{ "command": "gist_copy_url", "caption": "Copy Gist URL" },
{ "command": "gist_open_browser", "caption": "Open Gist In Browser"},
{ "command": "gist_update", "caption": "Update Gist" },
- { "command": "gist_list", "caption": "Get Gist List" }
+ { "command": "gist_rename_file", "caption": "Rename File…" },
+ { "command": "gist_rename", "caption": "Change Gist Description…" },
+ { "command": "gist_delete", "caption": "Delete Gist" }
]
}
View
16 gist.py
@@ -264,24 +264,20 @@ def on_gist_description(description):
for region in selections:
create_gist_with_text(self.view.substr(region))
-class GistCopyUrl(sublime_plugin.TextCommand):
+class GistViewCommand(object):
+ """A base class for commands operating on a gistified view"""
def is_enabled(self):
- return self.view.settings().get("gist_html_url") is not None
+ return self.view.settings().get("gist_url") is not None
+class GistCopyUrl(GistViewCommand, sublime_plugin.TextCommand):
def run(self, edit):
sublime.set_clipboard(self.view.settings().get("gist_html_url"))
-class GistOpenBrowser(sublime_plugin.TextCommand):
- def is_enabled(self):
- return self.view.settings().get("gist_html_url") is not None
-
+class GistOpenBrowser(GistViewCommand, sublime_plugin.TextCommand):
def run(self, edit):
webbrowser.open(self.view.settings().get("gist_html_url"))
-class GistUpdateCommand(sublime_plugin.TextCommand):
- def is_enabled(self):
- return self.view.settings().get("gist_url") is not None
-
+class GistUpdateCommand(GistViewCommand, sublime_plugin.TextCommand):
@catch_errors
def run(self, edit):
text = self.view.substr(sublime.Region(0, self.view.size()))
Please sign in to comment.
Something went wrong with that request. Please try again.