From 0cbc28ba3306c9d5d51a0e3e811eb1221ae91013 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 19 Aug 2021 16:33:09 -0400 Subject: [PATCH] Avoid -- More -- prompt during :Ggrep Resolves: https://github.com/tpope/vim-fugitive/issues/1814 --- autoload/fugitive.vim | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 21f7603..27bdac3 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -5260,12 +5260,24 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort echo title let list = s:SystemList(s:UserCommandList(a:options) + cmd + args)[0] call writefile(list + [''], tempfile, 'b') - call map(list, 's:GrepParseLine(options, dir, v:val)') - call s:QuickfixSet(listnr, list, 'a') - let press_enter_shortfall = &cmdheight - len(list) - if press_enter_shortfall > 0 - echo repeat("\n", press_enter_shortfall - 1) - endif + try + if &more + let more = 1 + set nomore + endif + call map(list, 's:GrepParseLine(options, dir, v:val)') + call s:QuickfixSet(listnr, list, 'a') + let press_enter_shortfall = &cmdheight - len(list) + if press_enter_shortfall > 0 + echo repeat("\n", press_enter_shortfall - 1) + elseif !a:bang && !empty(list) + echo "" + endif + finally + if exists('l:more') + let &more = more + endif + endtry call s:RunFinished(state) silent exe s:DoAutocmd('QuickFixCmdPost ' . event) if !a:bang && !empty(list)