From 2ebdeef9e0a7bb45499935db691bb50bf1045304 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 20 Jan 2020 06:20:12 -0500 Subject: [PATCH] Change :Git --paginate from :terminal to temp buffer The --paginate option to Git forces it to use $PAGER rather than its own configuration, so it makes perfect sense for Fugitive to take on the role of the pager. This also removes the same behavior for --no-pager, allowing the command to run with :! instead. I really don't like sudden backwards incompatible changes like this, but the old behavior was based on a bad understanding of how these options work, and I'd rather rip the band-aid off sooner rather than later. --- autoload/fugitive.vim | 12 +++++------- doc/fugitive.txt | 5 ++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c1fb6e3..eb4e5ba 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2182,18 +2182,16 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort else let opts = {} endif - if a:bang || args[0] =~# '^-P$\|^--no-pager$\|diff\%(tool\)\@!\|log\|^show$' || + if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') + if args[0] =~# '^-p$\|^--paginate$' + call remove(args, 0) + endif return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after endif - if index(['--paginate', '-p'], args[0]) >= 0 - let paginate_warning = 'fugitive: --paginate support is deprecated. Use :terminal directly' - let after = '|echohl WarningMsg|echo ' . string(paginate_warning) . '|echohl NONE' . after - endif if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || - \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || - \ index(['--paginate', '-p'], args[0]) >= 0 + \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 83d0d16..5e4bc5f 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -20,10 +20,9 @@ that are part of Git repositories). :G {args} but chdir to the repository tree first. For some subcommands, a Fugitive command is called instead. - *:Git!* :Git! {args} Like |:Git|, but capture the output into a temp file, -:Git --no-pager {args} and |:split| that temp file. Use :0Git to -:Git -P {args} |:edit| the temp file instead. A temp file is always +:Git --paginate {args} and |:split| that temp file. Use :0Git to +:Git -p {args} |:edit| the temp file instead. A temp file is always used for diff and log commands. *:Gstatus*