Mercurial > vim-gutentags
changeset 173:2cf3fb66285b
Use absolute paths for `ctags` if the tags file is not local.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 21 Feb 2017 12:36:45 -0800 |
parents | 02a94ff0db57 |
children | 721cba3cd20d 7c879d2e9b69 7b9c2f191e69 |
files | autoload/gutentags.vim autoload/gutentags/ctags.vim |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/gutentags.vim Sun Feb 19 20:47:50 2017 -0800 +++ b/autoload/gutentags.vim Tue Feb 21 12:36:45 2017 -0800 @@ -76,7 +76,8 @@ " Returns whether a path is rooted. if has('win32') || has('win64') function! gutentags#is_path_rooted(path) abort - return len(a:path) >= 2 && a:path[1] == ':' + return len(a:path) >= 2 && ( + \a:path[0] == '/' || a:path[0] == '\' || a:path[1] == ':') endfunction else function! gutentags#is_path_rooted(path) abort
--- a/autoload/gutentags/ctags.vim Sun Feb 19 20:47:50 2017 -0800 +++ b/autoload/gutentags/ctags.vim Tue Feb 21 12:36:45 2017 -0800 @@ -69,6 +69,7 @@ execute "chdir " . fnameescape(a:proj_dir) let l:tags_file_exists = filereadable(a:tags_file) + let l:tags_file_is_local = match(a:tags_file, '\v[/\\]') < 0 if l:tags_file_exists && g:gutentags_ctags_check_tagfile let l:first_lines = readfile(a:tags_file, '', 1) @@ -81,7 +82,7 @@ endif endif - if empty(g:gutentags_cache_dir) + if empty(g:gutentags_cache_dir) && l:tags_file_is_local " If we don't use the cache directory, we can pass relative paths " around. " @@ -107,7 +108,7 @@ let l:cmd .= ' -p "' . l:actual_proj_dir . '"' if a:write_mode == 0 && l:tags_file_exists let l:cur_file_path = expand('%:p') - if empty(g:gutentags_cache_dir) + if empty(g:gutentags_cache_dir) && l:tags_file_is_local let l:cur_file_path = fnamemodify(l:cur_file_path, ':.') endif let l:cmd .= ' -s "' . l:cur_file_path . '"'