From 1792fb9e1b28e03baa08bfd48b057e11c366518f Mon Sep 17 00:00:00 2001 From: Talha Ahmed Date: Wed, 14 May 2014 09:47:18 +0500 Subject: [PATCH] Find __doc__ window if opened in current tab --- autoload/jedi.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/autoload/jedi.vim b/autoload/jedi.vim index 7a8aca6..d0e55cc 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -48,9 +48,15 @@ endfun function! jedi#show_documentation() Python jedi_vim.show_documentation() - if bufnr("__doc__") > 0 - " If the __doc__ buffer is open in the current window, jump to it - silent execute "sbuffer ".bufnr("__doc__") + let bn = bufnr("__doc__") + if bn > 0 + let wi=index(tabpagebuflist(tabpagenr()), bn)) + if wi >= 0 + " If the __doc__ buffer is open in the current tab, jump to it + silent execute (wi+1).'wincmd w' + else + silent execute "sbuffer ".bn + endif else split '__doc__' endif