commit dba8a0705d95cda76d599bb7d09964d67741a5c5 (tree)
parent 8cf3d94a3adff7ee9468a1c396d0ae1ecfce9c91
Author: Jacob Niehus <jacob.niehus@gmail.com>
Date: Fri, 16 Oct 2015 15:43:12 -0700
Fix diff sometimes opening in preview window
If the previous window no longer exists when Gedit is called, the
attempt to change windows with 'wincmd p' fails and 'wincmd w' should be
used instead.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -1336,8 +1336,10 @@ function! s:Edit(cmd,bang,...) abort
if winnr('$') == 1
let tabs = (&go =~# 'e' || !has('gui_running')) && &stal && (tabpagenr('$') >= &stal)
execute 'rightbelow' (&lines - &previewheight - &cmdheight - tabs - 1 - !!&laststatus).'new'
- else
+ elseif winnr('#')
wincmd p
+ else
+ wincmd w
endif
if &diff
let mywinnr = winnr()