changeset 96:e03a661dc983

Some `ctags` implementations can't handle spaces in paths.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 Feb 2016 10:22:44 -0800
parents 74528efaa5eb
children 794ee111bce6
files autoload/gutentags/ctags.vim
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim	Sun Feb 21 10:21:43 2016 -0800
+++ b/autoload/gutentags/ctags.vim	Sun Feb 21 10:22:44 2016 -0800
@@ -22,6 +22,10 @@
     let g:gutentags_ctags_check_tagfile = 0
 endif
 
+if !exists('g:gutentags_ctags_no_space_in_paths')
+    let g:gutentags_ctags_no_space_in_paths = 1
+endif
+
 " }}}
 
 " Gutentags Module Interface {{{
@@ -30,8 +34,15 @@
 
 function! gutentags#ctags#init(project_root) abort
     " Figure out the path to the tags file.
+    if g:gutentags_ctags_no_space_in_paths
+        " We need to replace spaces in the project root because `ctags` seems
+        " incapable of reading/writing to tags files with spaces.
+        let l:fixed_project_root = tr(a:project_root, ' ', '_')
+    else
+        let l:fixed_project_root = a:project_root
+    endif
     let b:gutentags_files['ctags'] = gutentags#get_cachefile(
-                \a:project_root, g:gutentags_tagfile)
+                \l:fixed_project_root, g:gutentags_tagfile)
 
     " Set the tags file for Vim to use.
     if g:gutentags_auto_set_tags