From 59659093581aad2afacedc81f009ed6a4bfad275 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Fri, 15 Dec 2023 14:50:56 -0600 Subject: [PATCH] Buffer output when using the pager As of 10ed587f655578657e203735a9e439e823aab5fc all output is captured to a temp file before being displayed. When the output is not buffered, the stdout/stderr callback is called to perform post-processing for each output chunk. Instead, buffer all output and perform the post-processing all at once. This results in a substantial performance improvement for repositories with many commits. --- autoload/fugitive.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 655c174..19d2d08 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3933,6 +3933,8 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort let job = jobstart(argv, extend(jobopts, { \ 'pty': state.pty, \ 'TERM': 'dumb', + \ 'stdout_buffered': pager, + \ 'stderr_buffered': pager, \ 'on_stdout': function('s:RunReceive', [state, tmp, 'out']), \ 'on_stderr': function('s:RunReceive', [state, tmp, 'err']), \ 'on_exit': function('s:RunClose', [state, tmp]),