forked from jisaacks/GitGutter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6f9987d
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |