commit bb2797d313f8b1cfd6ec6f8ee9fad69506909f92 (tree)
parent 67e9756c35bf1e2f8384c166eac6b0d0ecf16640
Author: Tim Pope <code@tpope.net>
Date: Mon, 20 Aug 2018 01:11:29 -0400
Special case :0Gread to get around FileReadCmd limitations
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -2233,7 +2233,7 @@ function! s:EditParse(args) abort
let pre = []
let args = copy(a:args)
while !empty(args) && args[0] =~# '^+'
- call add(pre, escape(remove(args, 0), ' |"') . ' ')
+ call add(pre, ' ' . escape(remove(args, 0), ' |"'))
endwhile
if len(args)
let file = join(args)
@@ -2312,7 +2312,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort
if a:cmd ==# 'edit'
call s:BlurStatus()
endif
- return mods . ' ' . a:cmd . ' ' . pre . s:fnameescape(file)
+ return mods . ' ' . a:cmd . pre . ' ' . s:fnameescape(file)
endfunction
function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort
@@ -2347,7 +2347,10 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort
catch /^fugitive:/
return 'echoerr v:errmsg'
endtry
- return mods . ' ' . after . 'read ' . pre . s:fnameescape(file) . '|' . delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '')
+ if file =~# '^fugitive:' && after is# 0
+ return 'exe ' .string(mods . ' ' . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate'
+ endif
+ return mods . ' ' . after . 'read' . pre . ' ' . s:fnameescape(file) . '|' . delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '')
endfunction
function! s:EditRunComplete(A,L,P) abort