From bb2797d313f8b1cfd6ec6f8ee9fad69506909f92 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 20 Aug 2018 01:11:29 -0400 Subject: [PATCH] Special case :0Gread to get around FileReadCmd limitations --- autoload/fugitive.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index cacf634..bd4eced 100644 --- 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 -- 2.11.4.GIT