Mercurial > vim-gutentags
comparison autoload/gutentags/ctags.vim @ 167:34c57ad6eb45
Always use the potentially custom name for the tags file.
If the tags file got a custom name from `gutentags_init_user_func`, we need to
use that in all situations. However, the tags file name we get in the
`generate` function is a full path so we make it relative to the project root
if possible when we don't use a cache directory for tags files.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 18 Feb 2017 21:57:52 -0800 |
parents | cbc1ebe23ef1 |
children | 95afd985a4c3 0e7ffc799cc5 |
comparison
equal
deleted
inserted
replaced
166:1fe62e7f1fae | 167:34c57ad6eb45 |
---|---|
80 return | 80 return |
81 endif | 81 endif |
82 endif | 82 endif |
83 | 83 |
84 if empty(g:gutentags_cache_dir) | 84 if empty(g:gutentags_cache_dir) |
85 " If we don't use the cache directory, let's just use the tag filename | 85 " If we don't use the cache directory, we can pass relative paths |
86 " as specified by the user, since it's relative to the project root, | 86 " around. |
87 " and we are already `chdir`'d into it. | 87 " |
88 " Note that if we don't do this and pass a full path, `ctags` gets | 88 " Note that if we don't do this and pass a full path for the project |
89 " confused if the paths have spaces -- but not if you're *in* the | 89 " root, some `ctags` implementations like Exhuberant Ctags can get |
90 " root directory. | 90 " confused if the paths have spaces -- but not if you're *in* the root |
91 " directory, for some reason... | |
91 let l:actual_proj_dir = '.' | 92 let l:actual_proj_dir = '.' |
92 let l:actual_tags_file = g:gutentags_ctags_tagfile | 93 let l:actual_tags_file = fnamemodify(a:tags_file, ':.') |
93 else | 94 else |
94 " else: the tags file goes in a cache directory, so we need to specify | 95 " else: the tags file goes in a cache directory, so we need to specify |
95 " all the paths absolutely for `ctags` to do its job correctly. | 96 " all the paths absolutely for `ctags` to do its job correctly. |
96 let l:actual_proj_dir = a:proj_dir | 97 let l:actual_proj_dir = a:proj_dir |
97 let l:actual_tags_file = a:tags_file | 98 let l:actual_tags_file = a:tags_file |