Mercurial > vim-gutentags
comparison autoload/gutentags/ctags.vim @ 119:a66d90fd758b
expand() g:gutentags_ctags_executable
Allows "~/..." paths to work.
author | Justin M. Keyes <justinkz@gmail.com> |
---|---|
date | Sat, 14 May 2016 02:59:15 -0400 |
parents | df3b0ca48013 |
children | 6f15299869fc |
comparison
equal
deleted
inserted
replaced
117:df3b0ca48013 | 119:a66d90fd758b |
---|---|
1 " Ctags module for Gutentags | 1 " Ctags module for Gutentags |
2 | 2 |
3 " Global Options {{{ | 3 " Global Options {{{ |
4 | 4 |
5 if !exists('g:gutentags_ctags_executable') | 5 let g:gutentags_ctags_executable = get(g:, 'gutentags_ctags_executable', 'ctags') |
6 let g:gutentags_ctags_executable = 'ctags' | 6 let g:gutentags_tagfile = get(g:, 'gutentags_tagfile', 'tags') |
7 endif | 7 let g:gutentags_auto_set_tags = get(g:, 'gutentags_auto_set_tags', 1) |
8 | 8 let g:gutentags_ctags_options_file = get(g:, 'gutentags_ctags_options_file', '.gutctags') |
9 if !exists('g:gutentags_tagfile') | 9 let g:gutentags_ctags_check_tagfile = get(g:, 'gutentags_ctags_check_tagfile', 0) |
10 let g:gutentags_tagfile = 'tags' | |
11 endif | |
12 | |
13 if !exists('g:gutentags_auto_set_tags') | |
14 let g:gutentags_auto_set_tags = 1 | |
15 endif | |
16 | |
17 if !exists('g:gutentags_ctags_options_file') | |
18 let g:gutentags_ctags_options_file = '.gutctags' | |
19 endif | |
20 | |
21 if !exists('g:gutentags_ctags_check_tagfile') | |
22 let g:gutentags_ctags_check_tagfile = 0 | |
23 endif | |
24 | 10 |
25 " }}} | 11 " }}} |
26 | 12 |
27 " Gutentags Module Interface {{{ | 13 " Gutentags Module Interface {{{ |
28 | 14 |
38 if g:gutentags_auto_set_tags | 24 if g:gutentags_auto_set_tags |
39 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) | 25 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) |
40 endif | 26 endif |
41 | 27 |
42 " Check if the ctags executable exists. | 28 " Check if the ctags executable exists. |
43 if g:gutentags_enabled && executable(g:gutentags_ctags_executable) == 0 | 29 if g:gutentags_enabled && executable(expand(g:gutentags_ctags_executable, 1)) == 0 |
44 let g:gutentags_enabled = 0 | 30 let g:gutentags_enabled = 0 |
45 echoerr "Executable '".g:gutentags_ctags_executable."' can't be found. " | 31 echoerr "Executable '".g:gutentags_ctags_executable."' can't be found. " |
46 \."Gutentags will be disabled. You can re-enable it by " | 32 \."Gutentags will be disabled. You can re-enable it by " |
47 \."setting g:gutentags_enabled back to 1." | 33 \."setting g:gutentags_enabled back to 1." |
48 endif | 34 endif |
154 function! s:get_ctags_executable(proj_dir) abort | 140 function! s:get_ctags_executable(proj_dir) abort |
155 "Only consider the main filetype in cases like 'python.django' | 141 "Only consider the main filetype in cases like 'python.django' |
156 let l:ftype = get(split(&filetype, '\.'), 0, '') | 142 let l:ftype = get(split(&filetype, '\.'), 0, '') |
157 let l:proj_info = gutentags#get_project_info(a:proj_dir) | 143 let l:proj_info = gutentags#get_project_info(a:proj_dir) |
158 let l:type = get(l:proj_info, 'type', l:ftype) | 144 let l:type = get(l:proj_info, 'type', l:ftype) |
159 if exists('g:gutentags_ctags_executable_{l:type}') | 145 let exepath = exists('g:gutentags_ctags_executable_{l:type}') |
160 return g:gutentags_ctags_executable_{l:type} | 146 \ ? g:gutentags_ctags_executable_{l:type} : g:gutentags_ctags_executable |
161 else | 147 return expand(exepath, 1) |
162 return g:gutentags_ctags_executable | |
163 endif | |
164 endfunction | 148 endfunction |
165 | 149 |
166 function! s:process_options_file(proj_dir, path) abort | 150 function! s:process_options_file(proj_dir, path) abort |
167 if empty(g:gutentags_cache_dir) | 151 if empty(g:gutentags_cache_dir) |
168 " If we're not using a cache directory to store tag files, we can | 152 " If we're not using a cache directory to store tag files, we can |