From 49c2a4acb535e3c24b81c332a19934e980b731da Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 25 Jul 2018 16:08:59 -0400 Subject: [PATCH] Revert "Unify jump to file logic" This reverts commit 73c39195aee0c80f9ef3cd433ee315d72931864e, which broke opening in a different window from :Gstatus. --- autoload/fugitive.vim | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c633212..f7e3f0f 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3023,7 +3023,7 @@ function! fugitive#MapJumps(...) abort endif endfunction -function! s:CfileList() abort +function! s:cfile() abort try let myhash = s:DirRev(@%)[1] if len(myhash) @@ -3208,36 +3208,32 @@ function! s:CfileList() abort endtry endfunction -function! s:Cfile() abort - let pre = '' - let results = s:CfileList() - if empty(results) - return '' - elseif len(results) > 1 - let pre = '+' . join(map(results[1:-1], 'escape(v:val, " ")'), '\|') . ' ' - endif - return pre . s:fnameescape(s:Generate(results[0])) -endfunction - function! s:GF(mode) abort - let cfile = s:Cfile() - if len(cfile) - return a:mode . ' ' . cfile + try + let results = s:cfile() + catch /^fugitive:/ + return 'echoerr v:errmsg' + endtry + if len(results) + return s:Edit(a:mode, 0, '', results[0]).join(map(results[1:-1], '"|".v:val'), '') else return '' endif endfunction -function! fugitive#Cfile(...) abort +function! fugitive#Cfile() abort let pre = '' - let cfile = s:Cfile() - if empty(cfile) + let results = s:cfile() + if empty(results) let cfile = expand('') if &includeexpr =~# '\' sandbox let cfile = eval(substitute(&includeexpr, '\C\', '\=string(cfile)', 'g')) endif + return cfile + elseif len(results) > 1 + let pre = '+' . join(map(results[1:-1], 'escape(v:val, " ")'), '\|') . ' ' endif - return cfile + return pre . s:fnameescape(s:Generate(results[0])) endfunction function! fugitive#cfile() abort