소스 검색

Reuse plug window even if it's in another tab

Junegunn Choi 11 년 전
부모
커밋
8c915a5271
1개의 변경된 파일3개의 추가작업 그리고 10개의 파일을 삭제
  1. 3 10
      plug.vim

+ 3 - 10
plug.vim

@@ -498,7 +498,8 @@ function! s:new_window()
 endfunction
 
 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
 
 function! s:switch_in()
@@ -533,15 +534,7 @@ endfunction
 
 function! s:prepare()
   call s:job_abort()
-  if bufexists(s:plug_buf)
-    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
+  if s:switch_in()
     silent %d _
   else
     call s:new_window()