changeset 78:208130c6245e

Merge pull request #36 from GitHub.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 28 Jul 2015 21:30:12 -0700
parents fa749380e05a (diff) 892da510cdd2 (current diff)
children f08ae081b061 51c1a57811b3
files plugin/gutentags.vim
diffstat 6 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Tue Jul 28 04:23:18 2015 +0300
+++ b/autoload/gutentags.vim	Tue Jul 28 21:30:12 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	Tue Jul 28 04:23:18 2015 +0300
+++ b/autoload/gutentags/ctags.vim	Tue Jul 28 21:30:12 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	Tue Jul 28 04:23:18 2015 +0300
+++ b/plat/unix/update_tags.sh	Tue Jul 28 21:30:12 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	Tue Jul 28 04:23:18 2015 +0300
+++ b/plat/win32/update_tags.cmd	Tue Jul 28 21:30:12 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	Tue Jul 28 04:23:18 2015 +0300
+++ b/plugin/gutentags.vim	Tue Jul 28 21:30:12 2015 -0700
@@ -69,6 +69,9 @@
 if !exists('g:gutentags_cache_dir')
     let g:gutentags_cache_dir = ''
 else
+    " Make sure we get an absolute/resolved path (e.g. expanding `~/`), and
+    " strip any trailing slash.
+    let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':p')
     let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':s?[/\\]$??')
 endif
 
@@ -82,9 +85,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	Tue Jul 28 21:30:12 2015 -0700
@@ -0,0 +1,2 @@
+--recurse=yes
+