Reuse plug window even if it's in another tab

This commit is contained in:
Junegunn Choi 2014-10-10 10:23:00 +09:00
parent ee9f0e55b8
commit 8c915a5271

View file

@ -498,7 +498,8 @@ function! s:new_window()
endfunction endfunction
function! s:plug_window_exists() function! s:plug_window_exists()
return index(tabpagebuflist(s:plug_tab), s:plug_buf) >= 0 let buflist = tabpagebuflist(s:plug_tab)
return !empty(buflist) && index(buflist, s:plug_buf) >= 0
endfunction endfunction
function! s:switch_in() function! s:switch_in()
@ -533,15 +534,7 @@ endfunction
function! s:prepare() function! s:prepare()
call s:job_abort() call s:job_abort()
if bufexists(s:plug_buf) if s:switch_in()
let winnr = bufwinnr(s:plug_buf)
if winnr < 0
call s:new_window()
execute 'buffer' s:plug_buf
else
execute winnr 'wincmd w'
endif
setlocal modifiable
silent %d _ silent %d _
else else
call s:new_window() call s:new_window()