mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 20:43:47 -05:00
Don't use --color if grep doesn't support it
Not all versions of grep support the --color flag. This checks the output of grep --help when building the grep command and avoids using flags that aren't compatible with the version present. Fixes #234.
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
let s:grep_available = executable('grep')
|
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*\) @@'
|
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user