Mercurial > vim-gutentags
diff 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 |
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim Fri Jul 22 19:25:01 2016 -0700 +++ b/autoload/gutentags/ctags.vim Fri Jul 22 19:25:05 2016 -0700 @@ -79,10 +79,18 @@ let l:cur_file_path = fnamemodify(l:cur_file_path, ':.') endif let l:cmd .= ' -s "' . l:cur_file_path . '"' + else + let l:file_list_cmd = gutentags#get_project_file_list_cmd(l:actual_proj_dir) + if !empty(l:file_list_cmd) + let l:cmd .= ' -L ' . '"' . l:file_list_cmd. '"' + endif endif - " Pass the Gutentags recursive options file before the project - " options file, so that users can override --recursive. - let l:cmd .= ' -o "' . gutentags#get_res_file('ctags_recursive.options') . '"' + if empty(get(l:, 'file_list_cmd', '')) + " Pass the Gutentags recursive options file before the project + " options file, so that users can override --recursive. + " Omit --recursive if this project uses a file list command. + let l:cmd .= ' -o "' . gutentags#get_res_file('ctags_recursive.options') . '"' + endif let l:proj_options_file = a:proj_dir . '/' . \g:gutentags_ctags_options_file if filereadable(l:proj_options_file)