comparison autoload/gutentags/ctags.vim @ 86:7872cc9bbc2d

Check existing tags file as an opt-in thing for now. Looks like tags files don't all start with the `!_TAG_` magic header so I'm disabling it by default for now.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 14 Oct 2015 19:31:50 -0700
parents 96bfe5c37f37
children 8bf96f9f649c
comparison
equal deleted inserted replaced
85:0424970d81f8 86:7872cc9bbc2d
14 let g:gutentags_auto_set_tags = 1 14 let g:gutentags_auto_set_tags = 1
15 endif 15 endif
16 16
17 if !exists('g:gutentags_ctags_options_file') 17 if !exists('g:gutentags_ctags_options_file')
18 let g:gutentags_ctags_options_file = '.gutctags' 18 let g:gutentags_ctags_options_file = '.gutctags'
19 endif
20
21 if !exists('g:gutentags_ctags_check_tagfile')
22 let g:gutentags_ctags_check_tagfile = 0
19 endif 23 endif
20 24
21 " }}} 25 " }}}
22 26
23 " Gutentags Module Interface {{{ 27 " Gutentags Module Interface {{{
40 " these things. 44 " these things.
41 let l:prev_cwd = getcwd() 45 let l:prev_cwd = getcwd()
42 let l:work_dir = fnamemodify(a:tags_file, ':h') 46 let l:work_dir = fnamemodify(a:tags_file, ':h')
43 let l:tags_file_exists = filereadable(a:tags_file) 47 let l:tags_file_exists = filereadable(a:tags_file)
44 48
45 if l:tags_file_exists 49 if l:tags_file_exists && g:gutentags_ctags_check_tagfile
46 let l:first_lines = readfile(a:tags_file, '', 1) 50 let l:first_lines = readfile(a:tags_file, '', 1)
47 if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0 51 if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0
48 call gutentags#throw("File ".a:tags_file." doesn't appear to be ". 52 call gutentags#throw("File ".a:tags_file." doesn't appear to be ".
49 \"a ctags file. Please delete it and run ". 53 \"a ctags file. Please delete it and run ".
50 \":GutentagsUpdate!.") 54 \":GutentagsUpdate!.")