Run :Gstatus edit command at top level

This results in a cleaner error when calling :edit in a modified file.
This commit is contained in:
Tim Pope
2019-01-09 14:57:07 -05:00
parent b8a6fd204c
commit 6e74463965

View File

@@ -1894,7 +1894,7 @@ augroup END
function! s:Status(bang, count, mods) abort
try
let mods = a:mods ==# '<mods>' ? '' : a:mods
let mods = a:mods ==# '<mods>' || empty(a:mods) ? '' : a:mods . ' '
if mods !~# 'aboveleft|belowright\|leftabove\|rightbelow\|topleft\|botright'
let mods = 'topleft ' . mods
endif
@@ -1908,12 +1908,11 @@ function! s:Status(bang, count, mods) abort
endif
endfor
if a:count ==# 0
exe mods 'Gedit' . (a:bang ? '!' : '') arg
return mods . 'Gedit' . (a:bang ? '!' : '') . arg
elseif a:bang
exe mods 'Gpedit' arg
wincmd P
return mods . 'Gpedit' . arg . '|wincmd P'
else
exe mods a:count > 0 ? a:count : '' 'Gsplit' arg
return mods . (a:count > 0 ? a:count : '') . 'Gsplit' . arg
endif
catch /^fugitive:/
return 'echoerr v:errmsg'