From 0d96623015102fbf3b6a24e5d2f67291c8c71c0e Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sun, 23 Jan 2011 16:47:44 +1300 Subject: [PATCH] Only do type initialization once the tagbar is opened for the first time --- plugin/tagbar.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 457f468..d75e48c 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -57,6 +57,8 @@ if !exists('g:tagbar_sort') let g:tagbar_sort = 1 endif +let s:type_init_done = 0 + function! s:InitTypes() " Dictionary of the already processed files, indexed by file name with " complete path. @@ -145,9 +147,9 @@ function! s:InitTypes() let i += 1 endfor endfor -endfunction -call s:InitTypes() + let s:type_init_done = 1 +endfunction function! s:ToggleWindow() let tagbarwinnr = bufwinnr("__Tagbar__") @@ -160,6 +162,10 @@ function! s:ToggleWindow() endfunction function! s:OpenWindow() + if !s:type_init_done + call s:InitTypes() + endif + " If the tagbar window is already open jump to it let tagbarwinnr = bufwinnr('__Tagbar__') if tagbarwinnr != -1 && winnr() != tagbarwinnr