Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 6f9987dbc11f836245de8c29b65770c7d8dfa0c6 @jisaacks committed Dec 8, 2012
Showing with 70 additions and 0 deletions.
  1. +35 −0 .gitignore
  2. +35 −0 git_gutter.py
@@ -0,0 +1,35 @@
+*.py[cod]
+
+# C extensions
+*.so
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+lib
+lib64
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+nosetests.xml
+
+# Translations
+*.mo
+
+# Mr Developer
+.mr.developer.cfg
+.project
+.pydevproject
@@ -0,0 +1,35 @@
+import sublime, sublime_plugin
+
+class GitGutterCommand(sublime_plugin.TextCommand):
+ def run(self, edit):
+
+ self.lines_removed([6,7,8])
+ self.lines_added([9,10])
+ self.lines_modified([11,12])
+
+
+ def lines_to_regions(self, lines):
+ regions = []
+ for line in lines:
+ position = self.view.text_point(line-1, 0)
+ region = sublime.Region(position,position)
+ regions.append(region)
+ return regions
+
+ def lines_removed(self, lines):
+ regions = self.lines_to_regions(lines)
+ scope = "markup.deleted"
+ icon = 'bookmark'
+ self.view.add_regions('deleted', regions, scope, icon)
+
+ def lines_added(self, lines):
+ regions = self.lines_to_regions(lines)
+ scope = "markup.inserted"
+ icon = 'bookmark'
+ self.view.add_regions('inserted', regions, scope, icon)
+
+ def lines_modified(self, lines):
+ regions = self.lines_to_regions(lines)
+ scope = "markup.changed"
+ icon = 'bookmark'
+ self.view.add_regions('changed', regions, scope, icon)

0 comments on commit 6f9987d

Please sign in to comment.