From c7af455c95cc2c4ca18f135bf838418e7f876441 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 29 Jan 2014 10:57:20 +0100 Subject: [PATCH] Remove unnecessary shell redirection. While it is aesthetically nicer to discard the unused output from `git ls-files`, it isn't necessary. Discarding requires a shell redirection which exposes us to vim's shell quirks; it's not worth it. --- autoload/diff.vim | 2 +- autoload/utility.vim | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/autoload/diff.vim b/autoload/diff.vim index d882cc7..2f55842 100644 --- a/autoload/diff.vim +++ b/autoload/diff.vim @@ -4,7 +4,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' function! diff#run_diff(realtime, use_external_grep) - let cmd = 'git ls-files --error-unmatch' . utility#discard_stdout_and_stderr() . ' ' . shellescape(utility#file()) . ' && (' + let cmd = 'git ls-files --error-unmatch ' . shellescape(utility#file()) . ' && (' if a:realtime let blob_name = ':./' . fnamemodify(utility#file(),':t') diff --git a/autoload/utility.vim b/autoload/utility.vim index 110c9dc..e864512 100644 --- a/autoload/utility.vim +++ b/autoload/utility.vim @@ -59,17 +59,6 @@ function! utility#escape(str) endif endfunction -function! utility#discard_stdout_and_stderr() - if !exists('utility#discard') - if &shellredir ==? '>%s 2>&1' - let utility#discard = ' > /dev/null 2>&1' - else - let utility#discard = ' >& /dev/null' - endif - endif - return utility#discard -endfunction - function! utility#command_in_directory_of_file(cmd) let utility#cmd_in_dir = 'cd ' . utility#directory_of_file() . ' && ' . a:cmd return substitute(utility#cmd_in_dir, "'", '"', 'g')