Use :read for :{range}Git! --paginate

This commit is contained in:
Tim Pope
2020-02-22 22:12:26 -05:00
parent 5a5a95b90a
commit 31629d8bd1

View File

@@ -2460,8 +2460,8 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
if args[0] =~# '^-p$\|^--paginate$' if args[0] =~# '^-p$\|^--paginate$'
call remove(args, 0) call remove(args, 0)
let pager = 1 let pager = 1
if a:bang && a:line2 == 0 if a:bang && a:line2 >= 0
let editcmd .= '!' let editcmd = 'read'
elseif a:bang elseif a:bang
let editcmd = 'pedit' let editcmd = 'pedit'
endif endif
@@ -2469,8 +2469,12 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
let pager = fugitive#PagerFor(args, config) let pager = fugitive#PagerFor(args, config)
endif endif
if a:bang || pager is# 1 if a:bang || pager is# 1
if editcmd ==# 'read'
return s:ReadExec(a:line1, a:line2, a:range, a:mods, env, args, options) . after
else
return s:OpenExec(editcmd, a:mods, env, args, options) . after return s:OpenExec(editcmd, a:mods, env, args, options) . after
endif endif
endif
if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') ||
\ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') ||
\ type(pager) == type('') \ type(pager) == type('')