changeset 75:d12543f11eb9

Move the default `-R` option to an overridable "global" options file. This makes it possible for a `.gutctags` file to disable the `-R` flag. Also fixes Github issue #33.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 27 Jul 2015 14:18:10 -0700
parents cb1cf815052e
children fa749380e05a
files autoload/gutentags.vim autoload/gutentags/ctags.vim plat/unix/update_tags.sh plat/win32/update_tags.cmd plugin/gutentags.vim res/ctags.options
diffstat 6 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Sat Jul 18 08:52:14 2015 -0700
+++ b/autoload/gutentags.vim	Mon Jul 27 14:18:10 2015 -0700
@@ -46,6 +46,11 @@
     return g:gutentags_plat_dir . a:filename . g:gutentags_script_ext
 endfunction
 
+" Gets a file path in the resource folder.
+function! gutentags#get_res_file(filename) abort
+    return g:gutentags_res_dir . a:filename
+endfunction
+
 " }}}
 
 " Gutentags Setup {{{
--- a/autoload/gutentags/ctags.vim	Sat Jul 18 08:52:14 2015 -0700
+++ b/autoload/gutentags/ctags.vim	Mon Jul 27 14:18:10 2015 -0700
@@ -52,6 +52,16 @@
             let l:full_path = expand('%:p')
             let l:cmd .= ' -s "' . l:full_path . '"'
         endif
+        " Pass the Gutentags options file first, and then the project specific
+        " one, so that users can override the default behaviour.
+        let l:cmd .= ' -o "' . gutentags#get_res_file('ctags.options') . '"'
+        let l:proj_options_file = a:proj_dir . '/' . 
+                    \g:gutentags_ctags_options_file
+        if filereadable(l:proj_options_file)
+            let l:proj_options_file = s:process_options_file(
+                        \a:proj_dir, l:proj_options_file)
+            let l:cmd .= ' -o "' . l:proj_options_file . '"'
+        endif
         for ign in split(&wildignore, ',')
             let l:cmd .= ' -x ' . '"' . ign . '"'
         endfor
@@ -61,13 +71,6 @@
         if g:gutentags_pause_after_update
             let l:cmd .= ' -c'
         endif
-        let l:proj_options_file = a:proj_dir . '/' . 
-                    \g:gutentags_ctags_options_file
-        if filereadable(l:proj_options_file)
-            let l:proj_options_file = s:process_options_file(
-                        \a:proj_dir, l:proj_options_file)
-            let l:cmd .= ' -o "' . l:proj_options_file . '"'
-        endif
         if g:gutentags_trace
             if has('win32')
                 let l:cmd .= ' -l "' . a:tags_file . '.log"'
--- a/plat/unix/update_tags.sh	Sat Jul 18 08:52:14 2015 -0700
+++ b/plat/unix/update_tags.sh	Mon Jul 27 14:18:10 2015 -0700
@@ -79,8 +79,8 @@
 fi
 
 echo "Running ctags"
-echo "$CTAGS_EXE -R -f \"$TAGS_FILE.temp\" $CTAGS_ARGS \"$PROJECT_ROOT\""
-$CTAGS_EXE -R -f "$TAGS_FILE.temp" $CTAGS_ARGS "$PROJECT_ROOT"
+echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS \"$PROJECT_ROOT\""
+$CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS "$PROJECT_ROOT"
 
 echo "Replacing tags file"
 echo "mv -f \"$TAGS_FILE.temp\" \"$TAGS_FILE\""
--- a/plat/win32/update_tags.cmd	Sat Jul 18 08:52:14 2015 -0700
+++ b/plat/win32/update_tags.cmd	Mon Jul 27 14:18:10 2015 -0700
@@ -83,8 +83,8 @@
 )
 
 echo Running ctags >> %LOG_FILE%
-echo call "%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE%
-call "%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE% 2>&1
+echo call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE%
+call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE% 2>&1
 if ERRORLEVEL 1 (
     echo ERROR: Ctags executable returned non-zero code. >> %LOG_FILE%
     goto :Unlock
--- a/plugin/gutentags.vim	Sat Jul 18 08:52:14 2015 -0700
+++ b/plugin/gutentags.vim	Mon Jul 27 14:18:10 2015 -0700
@@ -82,9 +82,11 @@
 
 if has('win32')
     let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . "\\plat\\win32\\"
+    let g:gutentags_res_dir = expand('<sfile>:h:h:p') . "\\res\\"
     let g:gutentags_script_ext = '.cmd'
 else
     let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . '/plat/unix/'
+    let g:gutentags_res_dir = expand('<sfile>:h:h:p') . '/res/'
     let g:gutentags_script_ext = '.sh'
 endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/ctags.options	Mon Jul 27 14:18:10 2015 -0700
@@ -0,0 +1,2 @@
+--recurse=yes
+