diff --git a/autoload/grepper.vim b/autoload/grepper.vim index f4ef8d2..7404c1d 100644 --- a/autoload/grepper.vim +++ b/autoload/grepper.vim @@ -437,7 +437,7 @@ function! s:restore_mapping(mapping) endfunction " s:finish_up() {{{1 -function! s:finish_up(flags) abort +function! s:finish_up(flags) let qf = a:flags.quickfix let qlist = getqflist() let llist = getloclist(0) @@ -445,12 +445,15 @@ function! s:finish_up(flags) abort call s:restore_errorformat() - let title = has('nvim') ? s:cmdline : {'title': s:cmdline} - if qf - call setqflist(qlist, 'r', title) - else - call setloclist(0, llist, 'r', title) - endif + try + let title = has('nvim') ? s:cmdline : {'title': s:cmdline} + if qf + call setqflist(qlist, 'r', title) + else + call setloclist(0, llist, 'r', title) + endif + catch /E118/ + endtry if size == 0 execute (qf ? 'cclose' : 'lclose')