Mercurial > vim-gutentags
comparison autoload/gutentags.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 | 04288637e595 |
children | 7bc4df0225d1 3459a2522a3b e59321cbaff7 |
comparison
equal
deleted
inserted
replaced
135:4c9e2de7d46a | 136:286e5b3095d0 |
---|---|
74 break | 74 break |
75 endif | 75 endif |
76 endfor | 76 endfor |
77 | 77 |
78 let s:known_projects[a:path] = l:result | 78 let s:known_projects[a:path] = l:result |
79 endfunction | |
80 | |
81 function! gutentags#validate_cmd(cmd) abort | |
82 if !empty(a:cmd) && executable(split(a:cmd)[0]) | |
83 return a:cmd | |
84 endif | |
85 return "" | |
86 endfunction | |
87 | |
88 function! gutentags#get_project_file_list_cmd(path) abort | |
89 if type(g:gutentags_file_list_command) == type("") | |
90 return gutentags#validate_cmd(g:gutentags_file_list_command) | |
91 elseif type(g:gutentags_file_list_command) == type({}) | |
92 let l:markers = get(g:gutentags_file_list_command, 'markers', []) | |
93 if type(l:markers) == type({}) | |
94 for [marker, file_list_cmd] in items(l:markers) | |
95 if getftype(a:path . '/' . marker) != "" | |
96 return gutentags#validate_cmd(file_list_cmd) | |
97 endif | |
98 endfor | |
99 endif | |
100 endif | |
101 return "" | |
79 endfunction | 102 endfunction |
80 | 103 |
81 " Finds the first directory with a project marker by walking up from the given | 104 " Finds the first directory with a project marker by walking up from the given |
82 " file path. | 105 " file path. |
83 function! gutentags#get_project_root(path) abort | 106 function! gutentags#get_project_root(path) abort |