comparison autoload/gutentags/ctags.vim @ 136:286e5b3095d0

Allow restricting tag generation to files listed by custom commands This adds a new setting, g:gutentags_file_list_command, which specifies command(s) to use to list files for which tags should be generated, instead of recursively examining all files within the project root. This is useful in projects using source control to restrict tag generation to only files tracked in the repository. This setting is conceptually similar to CtrlP's ctrlp_user_command option. This implements the feature requested in https://github.com/ludovicchabant/vim-gutentags/issues/90
author Stephen Kent <smkent@smkent.net>
date Fri, 22 Jul 2016 19:25:05 -0700
parents 4c9e2de7d46a
children 7bc4df0225d1 e59321cbaff7
comparison
equal deleted inserted replaced
135:4c9e2de7d46a 136:286e5b3095d0
77 let l:cur_file_path = expand('%:p') 77 let l:cur_file_path = expand('%:p')
78 if empty(g:gutentags_cache_dir) 78 if empty(g:gutentags_cache_dir)
79 let l:cur_file_path = fnamemodify(l:cur_file_path, ':.') 79 let l:cur_file_path = fnamemodify(l:cur_file_path, ':.')
80 endif 80 endif
81 let l:cmd .= ' -s "' . l:cur_file_path . '"' 81 let l:cmd .= ' -s "' . l:cur_file_path . '"'
82 endif 82 else
83 " Pass the Gutentags recursive options file before the project 83 let l:file_list_cmd = gutentags#get_project_file_list_cmd(l:actual_proj_dir)
84 " options file, so that users can override --recursive. 84 if !empty(l:file_list_cmd)
85 let l:cmd .= ' -o "' . gutentags#get_res_file('ctags_recursive.options') . '"' 85 let l:cmd .= ' -L ' . '"' . l:file_list_cmd. '"'
86 endif
87 endif
88 if empty(get(l:, 'file_list_cmd', ''))
89 " Pass the Gutentags recursive options file before the project
90 " options file, so that users can override --recursive.
91 " Omit --recursive if this project uses a file list command.
92 let l:cmd .= ' -o "' . gutentags#get_res_file('ctags_recursive.options') . '"'
93 endif
86 let l:proj_options_file = a:proj_dir . '/' . 94 let l:proj_options_file = a:proj_dir . '/' .
87 \g:gutentags_ctags_options_file 95 \g:gutentags_ctags_options_file
88 if filereadable(l:proj_options_file) 96 if filereadable(l:proj_options_file)
89 let l:proj_options_file = s:process_options_file( 97 let l:proj_options_file = s:process_options_file(
90 \a:proj_dir, l:proj_options_file) 98 \a:proj_dir, l:proj_options_file)