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.
This commit is contained in:
Jacob Niehus authored and Tim Pope committed 2015-10-16 23:48:38 -04:00
1 parent 8cf3d94a3a
commit dba8a0705d
1 file changed
+3 -1
+3 -1
View File
@@ -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()