diff --git a/autoload/diff.vim b/autoload/diff.vim index 7d8a983..8d5d1e0 100644 --- a/autoload/diff.vim +++ b/autoload/diff.vim @@ -17,10 +17,15 @@ function! diff#run_diff(realtime, use_external_grep) endif if a:use_external_grep && s:grep_available - " grep exits with 1 when no matches are found. However we want to treat - " non-matches as non-erroneous behaviour; so we OR the command with one + let cmd .= s:grep_command + endif + + if (a:use_external_grep && s:grep_available) || a:realtime + " grep exits with 1 when no matches are found; diff exits with 1 when + " differences are found. However we want to treat non-matches and + " differences as non-erroneous behaviour; so we OR the command with one " which always returns true. - let cmd .= s:grep_command . ' || true' + let cmd.= ' || true' endif let cmd .= '))'