1
0
mirror of https://github.com/gryf/tagbar.git synced 2026-02-01 13:35:45 +01:00

Don't check ctags on each 'window open'

This commit is contained in:
Jan Larres
2011-05-12 20:50:14 +12:00
parent 7a06b1615f
commit 845754bdad

View File

@@ -121,6 +121,7 @@ endif
let s:type_init_done = 0
let s:autocommands_done = 0
let s:checked_ctags = 0
let s:window_expanded = 0
let s:access_symbols = {
@@ -878,6 +879,37 @@ function! s:CreateAutocommands()
let s:autocommands_done = 1
endfunction
" s:CheckForExCtags() {{{2
" Test whether the ctags binary is actually Exuberant Ctags and not GNU ctags
" (or something else)
function! s:CheckForExCtags()
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--version')
if ctags_cmd == ''
return
endif
let ctags_output = s:ExecuteCtags(ctags_cmd)
if v:shell_error || ctags_output !~# 'Exuberant Ctags'
echoerr 'Tagbar: Ctags doesn''t seem to be Exuberant Ctags!'
echomsg 'GNU ctags will NOT WORK.'
\ 'Please download Exuberant Ctags from ctags.sourceforge.net'
\ 'and install it in a directory in your $PATH'
\ 'or set g:tagbar_ctags_bin.'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
endif
return 0
else
let s:checked_ctags = 1
return 1
endif
endfunction
" Prototypes {{{1
" Base tag {{{2
let s:BaseTag = {}
@@ -1313,28 +1345,10 @@ function! s:OpenWindow(autoclose)
return
endif
" Test whether the ctags binary is actually Exuberant Ctags and not GNU
" ctags (or something else)
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--version')
if ctags_cmd == ''
return
endif
let ctags_output = s:ExecuteCtags(ctags_cmd)
if v:shell_error || ctags_output !~# 'Exuberant Ctags'
echoerr 'Tagbar: Ctags doesn''t seem to be Exuberant Ctags!'
echomsg 'GNU ctags will NOT WORK.'
\ 'Please download Exuberant Ctags from ctags.sourceforge.net'
\ 'and install it in a directory in your $PATH'
\ 'or set g:tagbar_ctags_bin.'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
return
endif
" Expand the Vim window to accomodate for the Tagbar window if requested