From 8d229c222c886d8811858242bdd248a4e965a7eb Mon Sep 17 00:00:00 2001 From: Dan Church Date: Mon, 11 Jan 2016 11:14:32 -0600 Subject: [PATCH] Clean up exposure of the grep command This change breaks up the determining of the user's grep command, and the arguments it sends it. Configuration is now: let g:gitgutter_grep_command = 'grep --color=never -e' This makes it easier for users to configure now, though not quite as flexible. --- README.mkd | 4 ++-- autoload/gitgutter/diff.vim | 6 +++--- doc/gitgutter.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.mkd b/README.mkd index e8c7b51..c703485 100644 --- a/README.mkd +++ b/README.mkd @@ -273,10 +273,10 @@ let g:gitgutter_escape_grep = 1 #### Use a custom `grep` command -If you use an alternative to grep, you can tell vim-gitgutter to use it here. +If you use an alternative to grep, you can tell vim-gitgutter to use it here. It only needs to support extended POSIX regex. ```viml -let g:gitgutter_grep_command = ' | grep --color=never -e "^@@"' +let g:gitgutter_grep_command = 'grep --color=never -e' ``` #### To turn off vim-gitgutter by default diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index 7efaaa8..82ae1d7 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -4,12 +4,12 @@ if exists('g:gitgutter_grep_command') else let s:grep_available = executable('grep') if s:grep_available - let s:grep_command = ' | '.(g:gitgutter_escape_grep ? '\grep' : 'grep') + 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('^@@ ') + let s:grep_command .= ' -e' endif endif let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' @@ -101,7 +101,7 @@ function! gitgutter#diff#run_diff(realtime, use_external_grep) endif if a:use_external_grep && s:grep_available - let cmd .= s:grep_command + let cmd .= ' | '.s:grep_command.' '.gitgutter#utility#shellescape('^@@ ') endif if (a:use_external_grep && s:grep_available) || a:realtime diff --git a/doc/gitgutter.txt b/doc/gitgutter.txt index c61ad05..d82fdbc 100644 --- a/doc/gitgutter.txt +++ b/doc/gitgutter.txt @@ -217,7 +217,7 @@ TO ESCAPE GREP To use a custom invocation for grep, use this: > - let g:gitgutter_grep_command = ' | grep --color=never -e "^@@ "' + let g:gitgutter_grep_command = 'grep --color=never -e' < To avoid any alias you have for grep, use this: