comparison autoload/gutentags/ctags.vim @ 185:685b81826b68

Only check for the ctags executable once.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 30 May 2017 12:16:20 -0700
parents 3cd4597fb86b
children 5fb056a9eefb
comparison
equal deleted inserted replaced
184:3cd4597fb86b 185:685b81826b68
33 call s:_handleOldOptions() 33 call s:_handleOldOptions()
34 " }}} 34 " }}}
35 35
36 " Gutentags Module Interface {{{ 36 " Gutentags Module Interface {{{
37 37
38 let s:did_check_exe = 0
38 let s:runner_exe = gutentags#get_plat_file('update_tags') 39 let s:runner_exe = gutentags#get_plat_file('update_tags')
39 let s:unix_redir = (&shellredir =~# '%s') ? &shellredir : &shellredir . ' %s' 40 let s:unix_redir = (&shellredir =~# '%s') ? &shellredir : &shellredir . ' %s'
40 41
41 function! gutentags#ctags#init(project_root) abort 42 function! gutentags#ctags#init(project_root) abort
42 " Figure out the path to the tags file. 43 " Figure out the path to the tags file.
52 if g:gutentags_ctags_auto_set_tags 53 if g:gutentags_ctags_auto_set_tags
53 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) 54 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags'])
54 endif 55 endif
55 56
56 " Check if the ctags executable exists. 57 " Check if the ctags executable exists.
57 if g:gutentags_enabled && executable(expand(g:gutentags_ctags_executable, 1)) == 0 58 if s:did_check_exe == 0
58 let g:gutentags_enabled = 0 59 if g:gutentags_enabled && executable(expand(g:gutentags_ctags_executable, 1)) == 0
59 echoerr "Executable '".g:gutentags_ctags_executable."' can't be found. " 60 let g:gutentags_enabled = 0
60 \."Gutentags will be disabled. You can re-enable it by " 61 echoerr "Executable '".g:gutentags_ctags_executable."' can't be found. "
61 \."setting g:gutentags_enabled back to 1." 62 \."Gutentags will be disabled. You can re-enable it by "
63 \."setting g:gutentags_enabled back to 1."
64 endif
65 let s:did_check_exe = 1
62 endif 66 endif
63 endfunction 67 endfunction
64 68
65 function! gutentags#ctags#generate(proj_dir, tags_file, write_mode) abort 69 function! gutentags#ctags#generate(proj_dir, tags_file, write_mode) abort
66 " Get to the tags file directory because ctags is finicky about 70 " Get to the tags file directory because ctags is finicky about