Created
April 26, 2014 13:47
-
-
Save skrat/11320473 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/dired.py b/dired.py | |
index 13517cd..6f5fb81 100644 | |
--- a/dired.py | |
+++ b/dired.py | |
@@ -277,34 +277,36 @@ class DiredRefreshCommand(TextCommand, DiredBaseCommand): | |
self.view.sel().add(Region(pt, pt)) | |
def vcs_check(self, edit, path, names, git='git'): | |
+ if not git: | |
+ git = 'git' | |
try: | |
- p = subprocess.Popen([git, 'status', '-z'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=path, shell=True) | |
+ p = subprocess.Popen("git status -z", stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=path, shell=True) | |
git_output = p.communicate()[0] | |
except: | |
pass # cant catch it, perhaps Im missing something obvious :/ | |
else: | |
# print(path, '\n', unicode(git_output.replace('\00', '\n'), 'utf8')) | |
if git_output: | |
- self.changed_items = dict((i[3:], i[1]) for i in git_output.split('\00') if i != '') | |
+ self.changed_items = dict((i[3:], i[1]) for i in str(git_output, 'utf-8').split('\x00') if i != '') | |
sublime.set_timeout(self.vcs_colorized, 1) | |
def vcs_colorized(self): | |
- rgns = dict() | |
+ rgns = [] | |
for fn in self.changed_items.keys(): | |
# print(fn.split()[0]) | |
# print(dirname(join(self.path, fn)) , dirname(self.path)) | |
if os.path.split(fn)[0] in dirname(self.path): | |
- r = self.view.find(unicode(basename(fn), 'utf8'), 0, sublime.LITERAL) | |
+ r = self.view.find(basename(fn), 0, sublime.LITERAL) | |
if r: | |
- rgns[r] = self.changed_items[fn] | |
+ rgns.append((r, self.changed_items[fn])) | |
modified, untracked = [], [] | |
- for r, status in rgns.items(): | |
+ for r, status in rgns: | |
if status == 'M': | |
modified.append(r) | |
elif status == '?': | |
untracked.append(r) | |
- self.view.add_regions('M', modified, 'item.modified.dired', sublime.DRAW_OUTLINED) | |
- self.view.add_regions('?', untracked, 'item.untracked.dired', sublime.DRAW_OUTLINED) | |
+ self.view.add_regions('M', modified, 'item.modified.dired', flags=sublime.DRAW_OUTLINED) | |
+ self.view.add_regions('?', untracked, 'item.untracked.dired', flags=sublime.DRAW_OUTLINED) | |
class DiredNextLineCommand(TextCommand, DiredBaseCommand): | |
def run(self, edit, forward=None): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment