Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created March 16, 2013 08:55
Show Gist options
  • Save jugyo/5175580 to your computer and use it in GitHub Desktop.
Save jugyo/5175580 to your computer and use it in GitHub Desktop.
git_commit_show command for Sublime Text
import sublime
from git import GitWindowCommand, plugin_file
class GitCommitShowCommand(GitWindowCommand):
def run(self):
if self.active_view() != None:
sha1 = self.active_view().substr(self.active_view().sel()[0])
if sha1 != "":
self.git_commit_show(sha1)
else:
self.git_commit_show_with_input_panel()
else:
self.git_commit_show_with_input_panel()
def git_commit_show_with_input_panel(self):
def on_done(result):
self.git_commit_show(result)
self.window.show_input_panel('sha1', '', on_done, None, None)
def git_commit_show(self, sha1):
def on_done(result, position=None):
self.scratch(result, title="Git Commit Details", position=position,
syntax=plugin_file("syntax/Git Commit Message.tmLanguage"))
self.run_command(['git', 'show', sha1], on_done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment