diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index af5ed8b..2524c20 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -1,5 +1,12 @@ let s:grep_available = executable('grep') -let s:grep_command = ' | '.(g:gitgutter_escape_grep ? '\grep' : 'grep').' --color=never -e '.gitgutter#utility#shellescape('^@@ ') +if s:grep_available + let s:grep_command = ' | '.(g:gitgutter_escape_grep ? '\grep' : 'grep') + let s:grep_help = gitgutter#utility#system('grep --help') + if s:grep_help =~# '--color' + let s:grep_command .= ' --color=never' + endif + let s:grep_command .= ' -e '.gitgutter#utility#shellescape('^@@ ') +endif let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'