From 99809a021c922ec154bf4cf3290143615a6a1b57 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 19 Jun 2014 16:40:26 -0400 Subject: [PATCH] Don't gratuitously clobber quickfix in :Ggrep --- plugin/fugitive.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 916efcd..c8576e2 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1070,14 +1070,16 @@ function! s:Grep(cmd,bang,arg) abort if bufname(entry.bufnr) =~ ':' let entry.filename = s:repo().translate(bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 elseif a:arg =~# '\%(^\| \)--cached\>' let entry.filename = s:repo().translate(':0:'.bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 endif endfor - if a:cmd =~# '^l' + if a:cmd =~# '^l' && exists('changed') call setloclist(0, list, 'r') - else + elseif exists('changed') call setqflist(list, 'r') endif if !a:bang && !empty(list)