diff autoload/gutentags/ctags.vim @ 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 18df731b1563
children 7b9c2f191e69
line wrap: on
line diff
--- 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 . '"'