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)