Permalink
Browse files

Close preview window when closing Tagbar

  • Loading branch information...
1 parent e090fe7 commit 915b11bd1c2df3cc91701f4f0d24df1511c200e1 @majutsushi committed Nov 22, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 autoload/tagbar.vim
View
@@ -58,6 +58,7 @@ let s:winrestcmd = ''
let s:short_help = 1
let s:nearby_disabled = 0
let s:paused = 0
+let s:pedit_by_tagbar = 0
let s:window_expanded = 0
let s:expand_bufnr = -1
@@ -70,7 +71,6 @@ let s:window_pos = {
" take extra arguments
let s:compare_typeinfo = {}
-
let s:visibility_symbols = {
\ 'public' : '+',
\ 'protected' : '#',
@@ -1842,6 +1842,11 @@ function! s:CloseWindow() abort
return
endif
+ " Close the preview window if it was opened by us
+ if s:pedit_by_tagbar
+ pclose
+ endif
+
let tagbarbufnr = winbufnr(tagbarwinnr)
if winnr() == tagbarwinnr
@@ -3014,6 +3019,9 @@ function! s:ShowInPreviewWin() abort
execute g:tagbar_previewwin_pos . ' pedit +' . taginfo.fields.line . ' ' .
\ s:known_files.getCurrent(0).fpath
+ " Remember that the preview window was opened by Tagbar so we can safely
+ " close it by ourselves
+ let s:pedit_by_tagbar = 1
call s:goto_win('P')
normal! zv

0 comments on commit 915b11b

Please sign in to comment.