comparison autoload/gutentags/ctags.vim @ 89:8bf96f9f649c

Add support for project types.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 01 Dec 2015 22:04:45 -0800
parents 7872cc9bbc2d
children edd488d8d37e
comparison
equal deleted inserted replaced
88:073e63cc0456 89:8bf96f9f649c
59 execute "chdir " . fnameescape(l:work_dir) 59 execute "chdir " . fnameescape(l:work_dir)
60 60
61 try 61 try
62 " Build the command line. 62 " Build the command line.
63 let l:cmd = gutentags#get_execute_cmd() . s:runner_exe 63 let l:cmd = gutentags#get_execute_cmd() . s:runner_exe
64 let l:cmd .= ' -e "' . s:get_ctags_executable() . '"' 64 let l:cmd .= ' -e "' . s:get_ctags_executable(a:proj_dir) . '"'
65 let l:cmd .= ' -t "' . a:tags_file . '"' 65 let l:cmd .= ' -t "' . a:tags_file . '"'
66 let l:cmd .= ' -p "' . a:proj_dir . '"' 66 let l:cmd .= ' -p "' . a:proj_dir . '"'
67 if a:write_mode == 0 && l:tags_file_exists 67 if a:write_mode == 0 && l:tags_file_exists
68 let l:full_path = expand('%:p') 68 let l:full_path = expand('%:p')
69 let l:cmd .= ' -s "' . l:full_path . '"' 69 let l:cmd .= ' -s "' . l:full_path . '"'
126 " }}} 126 " }}}
127 127
128 " Utilities {{{ 128 " Utilities {{{
129 129
130 " Get final ctags executable depending whether a filetype one is defined 130 " Get final ctags executable depending whether a filetype one is defined
131 function! s:get_ctags_executable() abort 131 function! s:get_ctags_executable(proj_dir) abort
132 "Only consider the main filetype in cases like 'python.django' 132 "Only consider the main filetype in cases like 'python.django'
133 let l:ftype = get(split(&filetype, '\.'), 0, '') 133 let l:ftype = get(split(&filetype, '\.'), 0, '')
134 if exists('g:gutentags_ctags_executable_{l:ftype}') 134 let l:proj_info = gutentags#get_project_info(a:proj_dir)
135 return g:gutentags_ctags_executable_{l:ftype} 135 let l:type = get(l:proj_info, 'type', l:ftype)
136 if exists('g:gutentags_ctags_executable_{l:type}')
137 return g:gutentags_ctags_executable_{l:type}
136 else 138 else
137 return g:gutentags_ctags_executable 139 return g:gutentags_ctags_executable
138 endif 140 endif
139 endfunction 141 endfunction
140 142