diff --git a/README.md b/README.md index fd949ad..8f7658e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ It's fast, highly configurable and well documented. Features: -- supports git, mercurial +- supports git, mercurial, bzr - apart from signs there is also optional line highlighting - you can toggle the plugin per buffer - fully configurable through global variables diff --git a/doc/signify.txt b/doc/signify.txt index 3cbf02b..fefd08e 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -47,6 +47,7 @@ version control system: - git - mercurial + - bzr The plugin defines 3 new kinds of signs and their corresponding highlighting classes. It tries to inherent existing colors from the LineNr class, if that diff --git a/plugin/signify.vim b/plugin/signify.vim index eaf7121..1941680 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -115,6 +115,11 @@ endfunction " Functions -> s:get_diff() {{{2 function! s:get_diff(path) abort + if !executable('grep') + echoerr "signify: I cannot work without grep!" + finish + endif + if executable('git') let diff = system('git diff --no-ext-diff -U0 '. fnameescape(a:path) .'| grep "^@@ "') if !v:shell_error @@ -129,6 +134,13 @@ function! s:get_diff(path) abort endif endif + if executable('bzr') && executable('diff') + let diff = system('bzr diff --using diff --diff-options=-U0 '. fnameescape(a:path) .'| grep "^@@ "') + if !v:shell_error + return diff + endif + endif + return [] endfunction @@ -205,7 +217,7 @@ function! s:process_diff(diff) abort " Parse diff output. let tokens = matchlist(line, '\v^\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)') if empty(tokens) - echoerr 'signify: Could not parse this line "'. line .'"' + echoerr 'signify: I cannot parse this line "'. line .'"' endif let [ old_line, old_count, new_line, new_count ] = [ str2nr(tokens[1]), (tokens[2] == '') ? 1 : str2nr(tokens[2]), str2nr(tokens[3]), (tokens[4] == '') ? 1 : str2nr(tokens[4]) ]