Support :rightbelow Gblame and other <mods>

Closes https://github.com/tpope/vim-fugitive/issues/976
This commit is contained in:
Tim Pope 2019-08-13 15:58:10 -04:00
parent 0a7ffc5d67
commit 08a9a45dbc

View File

@ -4763,15 +4763,20 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort
let temp = s:Resolve(temp) let temp = s:Resolve(temp)
let s:temp_files[s:cpath(temp)] = temp_state let s:temp_files[s:cpath(temp)] = temp_state
if len(ranges + commits + files) || raw if len(ranges + commits + files) || raw
let mods = s:Mods(a:mods)
if a:count != 0 if a:count != 0
exe 'silent keepalt split ' . s:fnameescape(temp) exe 'silent keepalt' mods 'split' . s:fnameescape(temp)
elseif !&modified || a:bang || &bufhidden ==# 'hide' || (empty(&bufhidden) && &hidden) elseif !&modified || a:bang || &bufhidden ==# 'hide' || (empty(&bufhidden) && &hidden)
exe 'silent edit' . (a:bang ? '! ' : ' ') . s:fnameescape(temp) exe 'silent' mods 'edit' . (a:bang ? '! ' : ' ') . s:fnameescape(temp)
else else
return 'edit ' . s:fnameescape(temp) return mods . 'edit ' . s:fnameescape(temp)
endif endif
return '' return ''
endif endif
if a:mods =~# '\<tab\>'
silent tabedit %
endif
let mods = substitute(a:mods, '\<tab\>', '', 'g')
for winnr in range(winnr('$'),1,-1) for winnr in range(winnr('$'),1,-1)
if getwinvar(winnr, '&scrollbind') if getwinvar(winnr, '&scrollbind')
call setwinvar(winnr, '&scrollbind', 0) call setwinvar(winnr, '&scrollbind', 0)
@ -4801,7 +4806,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort
endif endif
let top = line('w0') + &scrolloff let top = line('w0') + &scrolloff
let current = line('.') let current = line('.')
exe 'silent keepalt' (a:bang ? 'split' : 'leftabove vsplit') s:fnameescape(temp) exe 'silent keepalt' (a:bang ? s:Mods(mods) . 'split' : s:Mods(mods, 'leftabove') . 'vsplit') s:fnameescape(temp)
let w:fugitive_leave = restore let w:fugitive_leave = restore
execute top execute top
normal! zt normal! zt