motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 5aa8a3489eb02e4a4c9e572a5f86c8f42eb78d44 (tree)
parent ad8c1c80cc4b45c67e9d75622af6e1383c52d2e4
Author: Tim Pope <code@tpope.net>
Date:   Thu, 26 Aug 2021 09:04:30 -0400

Directly echo :Git output for a few trivial commands on Vim 7

If this works out, we can change the status buffer to directly call
:Git rather than routing through FugitiveExecute().

Diffstat:
Mautoload/fugitive.vim | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -2645,7 +2645,7 @@ function! fugitive#BufReadStatus() abort call s:Map('x', 's', ":<C-U>execute <SID>Do('Stage',1)<CR>", '<silent>') call s:Map('n', 'u', ":<C-U>execute <SID>Do('Unstage',0)<CR>", '<silent>') call s:Map('x', 'u', ":<C-U>execute <SID>Do('Unstage',1)<CR>", '<silent>') - call s:Map('n', 'U', ":<C-U>Git --no-pager reset -q<CR>", '<silent>') + call s:Map('n', 'U', ":<C-U>Git reset -q<CR>", '<silent>') call s:MapMotion('gu', "exe <SID>StageJump(v:count, 'Untracked', 'Unstaged')") call s:MapMotion('gU', "exe <SID>StageJump(v:count, 'Unstaged', 'Untracked')") call s:MapMotion('gs', "exe <SID>StageJump(v:count, 'Staged')") @@ -3435,9 +3435,10 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort if pager is# -1 let pager = fugitive#PagerFor(args, config) endif - if type(pager) ==# type('') || - \ (s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || + let wants_terminal = type(pager) ==# type('') || + \ (s:HasOpt(args, ['add', 'checkout', 'commit', 'reset', 'restore', 'stage', 'stash'], '-p', '--patch') || \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive')) && pager is# 0 + if wants_terminal let mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(options.git_dir) : '' let argv = s:UserCommandList(options) + args @@ -3591,7 +3592,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort endif let cmd = s:BuildEnvPrefix(env) . s:shellesc(s:UserCommandList(options) + args) let after = '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . after - if no_pager + if !wants_terminal && (no_pager || index(['add', 'clean', 'reset', 'restore', 'stage'], get(args, 0, '')) >= 0 || s:HasOpt(args, ['checkout'], '-q', '--quiet', '--no-progress')) let output = substitute(s:SystemError(cmd)[0], "\n$", '', '') if len(output) try @@ -3599,7 +3600,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let more = 1 set nomore endif - echo output + echo substitute(output, "\n$", "", "") finally if exists('l:more') set more