Always default to horizontal split for :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1163
This commit is contained in:
parent
75ca90739b
commit
b8a6fd204c
@ -1894,29 +1894,27 @@ augroup END
|
|||||||
|
|
||||||
function! s:Status(bang, count, mods) abort
|
function! s:Status(bang, count, mods) abort
|
||||||
try
|
try
|
||||||
let dir = b:git_dir
|
let mods = a:mods ==# '<mods>' ? '' : a:mods
|
||||||
let mods = a:mods ==# '<mods>' || empty(a:mods) ? 'leftabove' : a:mods
|
if mods !~# 'aboveleft|belowright\|leftabove\|rightbelow\|topleft\|botright'
|
||||||
|
let mods = 'topleft ' . mods
|
||||||
|
endif
|
||||||
let file = fugitive#Find(':')
|
let file = fugitive#Find(':')
|
||||||
|
let arg = '+setl\ foldmethod=syntax\ foldlevel=1\|let\ w:fugitive_status=FugitiveGitDir() :'
|
||||||
for winnr in range(1, winnr('$'))
|
for winnr in range(1, winnr('$'))
|
||||||
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
|
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
|
||||||
exe winnr . 'wincmd w'
|
exe winnr . 'wincmd w'
|
||||||
let w:fugitive_status = dir
|
let w:fugitive_status = FugitiveGitDir()
|
||||||
return s:ReloadStatus()
|
return s:ReloadStatus()
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
let wide = winwidth(0) >= 160
|
|
||||||
if a:count ==# 0
|
if a:count ==# 0
|
||||||
exe mods 'Gedit :'
|
exe mods 'Gedit' . (a:bang ? '!' : '') arg
|
||||||
elseif a:bang
|
elseif a:bang
|
||||||
exe mods (a:count ==# -1 && wide ? 'vert' : '') 'Gpedit :'
|
exe mods 'Gpedit' arg
|
||||||
wincmd P
|
wincmd P
|
||||||
elseif a:count ==# -1 && wide
|
|
||||||
exe mods 'Gvsplit :'
|
|
||||||
else
|
else
|
||||||
exe mods a:count > 0 ? a:count : '' 'Gsplit :'
|
exe mods a:count > 0 ? a:count : '' 'Gsplit' arg
|
||||||
endif
|
endif
|
||||||
let w:fugitive_status = dir
|
|
||||||
setlocal foldmethod=syntax foldlevel=1
|
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
endtry
|
endtry
|
||||||
@ -2862,7 +2860,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:UsableWin(nr) abort
|
function! s:UsableWin(nr) abort
|
||||||
return a:nr && !getwinvar(a:nr, '&previewwindow') &&
|
return a:nr && !getwinvar(a:nr, '&previewwindow') &&
|
||||||
\ empty(getwinvar(a:nr, 'fugitive_status')) &&
|
\ (empty(getwinvar(a:nr, 'fugitive_status')) || getwinvar(a:nr, 'fugitive_type') !=# 'index') &&
|
||||||
\ index(['gitrebase', 'gitcommit'], getbufvar(winbufnr(a:nr), '&filetype')) < 0 &&
|
\ index(['gitrebase', 'gitcommit'], getbufvar(winbufnr(a:nr), '&filetype')) < 0 &&
|
||||||
\ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0
|
\ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0
|
||||||
endfunction
|
endfunction
|
||||||
@ -2891,8 +2889,7 @@ function! s:BlurStatus() abort
|
|||||||
if len(winnrs)
|
if len(winnrs)
|
||||||
exe winnrs[0].'wincmd w'
|
exe winnrs[0].'wincmd w'
|
||||||
else
|
else
|
||||||
let wide = winwidth(0) >= 160
|
belowright new
|
||||||
exe 'rightbelow' (winwidth(0) >= 160 ? 'vert' : '') 'new'
|
|
||||||
endif
|
endif
|
||||||
if &diff
|
if &diff
|
||||||
let mywinnr = winnr()
|
let mywinnr = winnr()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user