diff autoload/gutentags/ctags.vim @ 70:661a97eaf608

Move `get_ctags_executable` to the `ctags` module.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 16 Jul 2015 21:43:06 -0700
parents 6900302dae0b
children d12543f11eb9
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim	Thu Jul 16 21:40:52 2015 -0700
+++ b/autoload/gutentags/ctags.vim	Thu Jul 16 21:43:06 2015 -0700
@@ -45,7 +45,7 @@
     try
         " Build the command line.
         let l:cmd = gutentags#get_execute_cmd() . s:runner_exe
-        let l:cmd .= ' -e "' . gutentags#get_ctags_executable() . '"'
+        let l:cmd .= ' -e "' . s:get_ctags_executable() . '"'
         let l:cmd .= ' -t "' . a:tags_file . '"'
         let l:cmd .= ' -p "' . a:proj_dir . '"'
         if a:write_mode == 0 && filereadable(a:tags_file)
@@ -108,6 +108,17 @@
 
 " Utilities {{{
 
+" Get final ctags executable depending whether a filetype one is defined
+function! s:get_ctags_executable() abort
+    "Only consider the main filetype in cases like 'python.django'
+    let l:ftype = get(split(&filetype, '\.'), 0, '')
+    if exists('g:gutentags_ctags_executable_{l:ftype}')
+        return g:gutentags_ctags_executable_{l:ftype}
+    else
+        return g:gutentags_ctags_executable
+    endif
+endfunction
+
 function! s:process_options_file(proj_dir, path) abort
     if g:gutentags_cache_dir == ""
         " If we're not using a cache directory to store tag files, we can