mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-14 07:47:13 +08:00
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:
@@ -1894,7 +1894,7 @@ augroup END
|
|||||||
|
|
||||||
function! s:Status(bang, count, mods) abort
|
function! s:Status(bang, count, mods) abort
|
||||||
try
|
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'
|
if mods !~# 'aboveleft|belowright\|leftabove\|rightbelow\|topleft\|botright'
|
||||||
let mods = 'topleft ' . mods
|
let mods = 'topleft ' . mods
|
||||||
endif
|
endif
|
||||||
@@ -1908,12 +1908,11 @@ function! s:Status(bang, count, mods) abort
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if a:count ==# 0
|
if a:count ==# 0
|
||||||
exe mods 'Gedit' . (a:bang ? '!' : '') arg
|
return mods . 'Gedit' . (a:bang ? '!' : '') . arg
|
||||||
elseif a:bang
|
elseif a:bang
|
||||||
exe mods 'Gpedit' arg
|
return mods . 'Gpedit' . arg . '|wincmd P'
|
||||||
wincmd P
|
|
||||||
else
|
else
|
||||||
exe mods a:count > 0 ? a:count : '' 'Gsplit' arg
|
return mods . (a:count > 0 ? a:count : '') . 'Gsplit' . arg
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
|
|||||||
Reference in New Issue
Block a user