Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 1d31729555748ecf095eac469020d7987482ea94 @notanumber committed Mar 23, 2011
Showing with 56 additions and 0 deletions.
  1. +7 −0 Default (OSX).sublime-keymap
  2. +49 −0 GitCommand.py
@@ -0,0 +1,7 @@
+[
+ { "keys": ["ctrl+super+c"], "command": "git_commit"},
+ { "keys": ["ctrl+super+a"], "command": "git_add"},
+ { "keys": ["ctrl+super+r"], "command": "git_rm"},
+ { "keys": ["ctrl+super+d"], "command": "git_diff"},
+ { "keys": ["ctrl+super+s"], "command": "git_status"}
+]
@@ -0,0 +1,49 @@
+import subprocess
+
+import sublime
+import sublime_plugin
+
+
+class GitCommand(sublime_plugin.WindowCommand):
+ def run(self):
+ p = subprocess.Popen(self.command_string, shell=True, bufsize=1024, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p.wait()
+ stdout = p.stdout
+ stderr = p.stderr
+ results = [stdout.read(), stderr.read()]
+
+ self.output_view = self.window.get_output_panel('git')
+ self.window.get_output_panel('git')
+
+ self.window.run_command('show_panel', {'panel': 'output.git'})
+
+ self.output_view.set_read_only(False)
+ edit = self.output_view.begin_edit()
+ self.output_view.insert(edit, self.output_view.size(), '\n'.join(results))
+ self.output_view.end_edit(edit)
+ self.output_view.set_read_only(True)
+
+
+# class GitCommitCommand(GitCommand):
+# command_string = 'git commit'
+
+# class GitAddCommand(GitCommand):
+# command_string = 'git add "%s"' % str(self.view.fileName())
+
+# class GitInitCommand(GitCommand):
+# command_string = 'git init'
+
+# class GitRmCommand(GitCommand):
+# command_string = 'git rm "%s"' % str(self.view.fileName())
+
+# class GitDiffCommand(GitCommand):
+# command_string = 'git diff "%s"' % str(self.view.fileName())
+
+# class GitPushCommand(GitCommand):
+# command_string = 'git push'
+
+# class GitPullCommand(GitCommand):
+# command_string = 'git pull'
+
+class GitStatusCommand(GitCommand):
+ command_string = 'git status'

0 comments on commit 1d31729

Please sign in to comment.