Always default to horizontal split for :Gstatus

Closes https://github.com/tpope/vim-fugitive/issues/1163
This commit is contained in:
Tim Pope 2019-01-08 20:23:04 -05:00
parent 75ca90739b
commit b8a6fd204c

View File

@ -1894,29 +1894,27 @@ augroup END
function! s:Status(bang, count, mods) abort
try
let dir = b:git_dir
let mods = a:mods ==# '<mods>' || empty(a:mods) ? 'leftabove' : a:mods
let mods = a:mods ==# '<mods>' ? '' : a:mods
if mods !~# 'aboveleft|belowright\|leftabove\|rightbelow\|topleft\|botright'
let mods = 'topleft ' . mods
endif
let file = fugitive#Find(':')
let arg = '+setl\ foldmethod=syntax\ foldlevel=1\|let\ w:fugitive_status=FugitiveGitDir() :'
for winnr in range(1, winnr('$'))
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
exe winnr . 'wincmd w'
let w:fugitive_status = dir
let w:fugitive_status = FugitiveGitDir()
return s:ReloadStatus()
endif
endfor
let wide = winwidth(0) >= 160
if a:count ==# 0
exe mods 'Gedit :'
exe mods 'Gedit' . (a:bang ? '!' : '') arg
elseif a:bang
exe mods (a:count ==# -1 && wide ? 'vert' : '') 'Gpedit :'
exe mods 'Gpedit' arg
wincmd P
elseif a:count ==# -1 && wide
exe mods 'Gvsplit :'
else
exe mods a:count > 0 ? a:count : '' 'Gsplit :'
exe mods a:count > 0 ? a:count : '' 'Gsplit' arg
endif
let w:fugitive_status = dir
setlocal foldmethod=syntax foldlevel=1
catch /^fugitive:/
return 'echoerr v:errmsg'
endtry
@ -2862,7 +2860,7 @@ endfunction
function! s:UsableWin(nr) abort
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(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0
endfunction
@ -2891,8 +2889,7 @@ function! s:BlurStatus() abort
if len(winnrs)
exe winnrs[0].'wincmd w'
else
let wide = winwidth(0) >= 160
exe 'rightbelow' (winwidth(0) >= 160 ? 'vert' : '') 'new'
belowright new
endif
if &diff
let mywinnr = winnr()