From 5f5e5e1b70a3f79c3f4bbd1dc54a3014b1006608 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Wed, 12 Jan 2011 23:30:38 +1300 Subject: [PATCH] prepare autoclose functionality --- plugin/tagbar.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 9bd5e35..7d3ca84 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -49,6 +49,10 @@ if !exists('g:tagbar_types') let g:tagbar_types = {} endif +if !exists('g:tagbar_autoclose') + let g:tagbar_autoclose = 0 +endif + function! s:InitTypes() let s:known_files = {} let s:known_types = {} @@ -190,12 +194,6 @@ function! s:RefreshContent() return endif - let tagbarwinnr = bufwinnr('__Tagbar__') - - if tagbarwinnr == -1 - return - endif - if has_key(s:known_files, fname) if s:known_files[fname].mtime != getftime(fname) call s:ProcessFile(fname, &filetype) @@ -204,7 +202,11 @@ function! s:RefreshContent() call s:ProcessFile(fname, &filetype) endif - call s:RenderContent(fname, &filetype) + let tagbarwinnr = bufwinnr('__Tagbar__') + + if tagbarwinnr != -1 + call s:RenderContent(fname, &filetype) + endif endfunction function! s:IsValidFile(fname, ftype)