Focus diff window on :Gdiff

References #36.
This commit is contained in:
Tim Pope 2013-12-30 10:45:54 -05:00
parent 1b0ddad697
commit 546a6bf219

View File

@ -1500,14 +1500,14 @@ function! s:Diff(bang,...)
try
let spec = s:repo().translate(file)
let commit = matchstr(spec,'\C[^:/]//\zs\x\+')
let restore = s:diff_restore()
let w:fugitive_diff_restore = restore
if s:buffer().compare_age(commit) < 0
execute 'rightbelow '.vert.'split '.s:fnameescape(spec)
execute 'rightbelow '.vert.'diffsplit '.s:fnameescape(spec)
else
execute 'leftabove '.vert.'split '.s:fnameescape(spec)
execute 'leftabove '.vert.'diffsplit '.s:fnameescape(spec)
endif
call s:diffthis()
wincmd p
call s:diffthis()
let w:fugitive_diff_restore = restore
return ''
catch /^fugitive:/
return 'echoerr v:errmsg'