Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

preview window should close when jumping to tag #184

Closed
fritzophrenic opened this Issue Dec 6, 2013 · 1 comment

Comments

Projects
None yet
2 participants

I love the new preview window functionality! It's nice to be able to quickly see the tag without jumping to it.

But it's annoying when I jump to a tag, that now the tag is displayed in 2 places unnecessarily. The first thing I always do is <C-W>z to close the preview window.

This makes it happen automatically when jumping to a tag and leaving the tagbar window:

diff -r 957c81121956 -r 774c4387da47 bundle/tagbar/autoload/tagbar.vim
--- a/bundle/tagbar/autoload/tagbar.vim Fri Dec 06 09:20:18 2013 -0600
+++ b/bundle/tagbar/autoload/tagbar.vim Fri Dec 06 10:14:36 2013 -0600
@@ -3007,8 +3007,13 @@
         call s:goto_win(tagbarwinnr)
         redraw
     elseif g:tagbar_autoclose || autoclose
+        " also closes preview window
         call s:CloseWindow()
     else
+        " Close the preview window if it was opened by us
+        if s:pwin_by_tagbar
+            pclose
+        endif
         call s:HighlightTag(0)
     endif
 endfunction
Owner

majutsushi commented Dec 18, 2013

Hey, sorry for the late reply! I had been thinking about this over the last few days as I wanted to be sure that this doesn't do anything unexpected, as I wasn't sure whether people may want to keep the preview window open as a guide. But if the autopreview option is enabled it's redundant anyway, and if not then there would be alternatives. Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment