mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-08 13:04:51 +08:00
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().
This commit is contained in:
@@ -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('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('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('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, 'Untracked', 'Unstaged')")
|
||||||
call s:MapMotion('gU', "exe <SID>StageJump(v:count, 'Unstaged', 'Untracked')")
|
call s:MapMotion('gU', "exe <SID>StageJump(v:count, 'Unstaged', 'Untracked')")
|
||||||
call s:MapMotion('gs', "exe <SID>StageJump(v:count, 'Staged')")
|
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
|
if pager is# -1
|
||||||
let pager = fugitive#PagerFor(args, config)
|
let pager = fugitive#PagerFor(args, config)
|
||||||
endif
|
endif
|
||||||
if type(pager) ==# type('') ||
|
let wants_terminal = type(pager) ==# type('') ||
|
||||||
\ (s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') ||
|
\ (s:HasOpt(args, ['add', 'checkout', 'commit', 'reset', 'restore', 'stage', 'stash'], '-p', '--patch') ||
|
||||||
\ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive')) && pager is# 0
|
\ 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 mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g')
|
||||||
let assign = len(dir) ? '|let b:git_dir = ' . string(options.git_dir) : ''
|
let assign = len(dir) ? '|let b:git_dir = ' . string(options.git_dir) : ''
|
||||||
let argv = s:UserCommandList(options) + args
|
let argv = s:UserCommandList(options) + args
|
||||||
@@ -3591,7 +3592,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
|
|||||||
endif
|
endif
|
||||||
let cmd = s:BuildEnvPrefix(env) . s:shellesc(s:UserCommandList(options) + args)
|
let cmd = s:BuildEnvPrefix(env) . s:shellesc(s:UserCommandList(options) + args)
|
||||||
let after = '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . after
|
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$", '', '')
|
let output = substitute(s:SystemError(cmd)[0], "\n$", '', '')
|
||||||
if len(output)
|
if len(output)
|
||||||
try
|
try
|
||||||
@@ -3599,7 +3600,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
|
|||||||
let more = 1
|
let more = 1
|
||||||
set nomore
|
set nomore
|
||||||
endif
|
endif
|
||||||
echo output
|
echo substitute(output, "\n$", "", "")
|
||||||
finally
|
finally
|
||||||
if exists('l:more')
|
if exists('l:more')
|
||||||
set more
|
set more
|
||||||
|
|||||||
Reference in New Issue
Block a user