Eliminate :cd in :Gread! and :Gblame
This commit is contained in:
parent
2ddf4e97ef
commit
6b1e749849
@ -1009,15 +1009,6 @@ function! s:SplitExpandChain(string, ...) abort
|
|||||||
return s:ExpandSplit(a:string, 1, a:0 ? a:1 : getcwd())
|
return s:ExpandSplit(a:string, 1, a:0 ? a:1 : getcwd())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ShellExpand(cmd, ...) abort
|
|
||||||
return s:shellesc(s:SplitExpand(a:cmd, a:0 ? a:1 : getcwd()))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:ShellExpandChain(cmd, ...) abort
|
|
||||||
let [args, after] = s:SplitExpandChain(a:cmd, a:0 ? a:1 : getcwd())
|
|
||||||
return [s:shellesc(args), after]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:trees = {}
|
let s:trees = {}
|
||||||
let s:indexes = {}
|
let s:indexes = {}
|
||||||
function! s:TreeInfo(dir, commit) abort
|
function! s:TreeInfo(dir, commit) abort
|
||||||
@ -3581,14 +3572,10 @@ function! s:ReadCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
let delete = ''
|
let delete = ''
|
||||||
endif
|
endif
|
||||||
if a:bang
|
if a:bang
|
||||||
try
|
let dir = s:Dir()
|
||||||
let cdback = s:Cd(s:Tree())
|
let git = s:UserCommand(dir)
|
||||||
let git = s:UserCommand()
|
let args = s:shellesc(s:SplitExpand(a:arg, s:Tree(dir)))
|
||||||
let args = s:ShellExpand(a:arg)
|
silent execute mods . after . 'read!' escape(git . ' --no-pager ' . args, '!#%')
|
||||||
silent execute mods . after . 'read!' escape(git . ' --no-pager ' . args, '!#%')
|
|
||||||
finally
|
|
||||||
execute cdback
|
|
||||||
endtry
|
|
||||||
execute delete . 'diffupdate'
|
execute delete . 'diffupdate'
|
||||||
call fugitive#ReloadStatus()
|
call fugitive#ReloadStatus()
|
||||||
return 'redraw|echo '.string(':!'.git.' '.args)
|
return 'redraw|echo '.string(':!'.git.' '.args)
|
||||||
@ -4189,18 +4176,13 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
endif
|
endif
|
||||||
let cmd += ['--', expand('%:p')]
|
let cmd += ['--', expand('%:p')]
|
||||||
let basecmd = escape(fugitive#Prepare(cmd), '!#%')
|
let basecmd = escape(fugitive#Prepare(cmd), '!#%')
|
||||||
try
|
let error = tempname()
|
||||||
let cdback = s:Cd(s:Tree())
|
let temp = error.'.fugitiveblame'
|
||||||
let error = tempname()
|
if &shell =~# 'csh'
|
||||||
let temp = error.'.fugitiveblame'
|
silent! execute '%write !('.basecmd.' > '.temp.') >& '.error
|
||||||
if &shell =~# 'csh'
|
else
|
||||||
silent! execute '%write !('.basecmd.' > '.temp.') >& '.error
|
silent! execute '%write !'.basecmd.' > '.temp.' 2> '.error
|
||||||
else
|
endif
|
||||||
silent! execute '%write !'.basecmd.' > '.temp.' 2> '.error
|
|
||||||
endif
|
|
||||||
finally
|
|
||||||
execute cdback
|
|
||||||
endtry
|
|
||||||
try
|
try
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
call s:throw(join(readfile(error),"\n"))
|
call s:throw(join(readfile(error),"\n"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user