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 2015-10-16 15:43:12 -07:00 committed by Tim Pope
parent 8cf3d94a3a
commit dba8a0705d

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()