From a93bd87715037be38dec988cfa82a8c3b8d7bbd5 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Wed, 21 Dec 2011 17:03:12 +1300 Subject: [PATCH] Extract some init steps into function --- autoload/tagbar.vim | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index a8ef62b..ddc959a 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -102,6 +102,19 @@ let s:last_highlight_tline = 0 let s:debug = 0 let s:debug_file = '' +" s:Init() {{{2 +function! s:Init() + if !s:type_init_done + call s:InitTypes() + endif + + if !s:checked_ctags + if !s:CheckForExCtags() + return + endif + endif +endfunction + " s:InitTypes() {{{2 function! s:InitTypes() call s:LogDebugMessage('Initializing types') @@ -818,15 +831,7 @@ function! s:RestoreSession() endif endif - if !s:type_init_done - call s:InitTypes() - endif - - if !s:checked_ctags - if !s:CheckForExCtags() - return - endif - endif + call s:Init() call s:InitWindow(g:tagbar_autoclose) @@ -1407,15 +1412,7 @@ function! s:OpenWindow(flags) return endif - if !s:type_init_done - call s:InitTypes() - endif - - if !s:checked_ctags - if !s:CheckForExCtags() - return - endif - endif + call s:Init() " Expand the Vim window to accomodate for the Tagbar window if requested if g:tagbar_expand && !s:window_expanded && has('gui_running')