Mercurial > vim-gutentags
comparison autoload/gutentags/ctags.vim @ 96:e03a661dc983
Some `ctags` implementations can't handle spaces in paths.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 21 Feb 2016 10:22:44 -0800 |
parents | edd488d8d37e |
children | d645125192aa |
comparison
equal
deleted
inserted
replaced
95:74528efaa5eb | 96:e03a661dc983 |
---|---|
20 | 20 |
21 if !exists('g:gutentags_ctags_check_tagfile') | 21 if !exists('g:gutentags_ctags_check_tagfile') |
22 let g:gutentags_ctags_check_tagfile = 0 | 22 let g:gutentags_ctags_check_tagfile = 0 |
23 endif | 23 endif |
24 | 24 |
25 if !exists('g:gutentags_ctags_no_space_in_paths') | |
26 let g:gutentags_ctags_no_space_in_paths = 1 | |
27 endif | |
28 | |
25 " }}} | 29 " }}} |
26 | 30 |
27 " Gutentags Module Interface {{{ | 31 " Gutentags Module Interface {{{ |
28 | 32 |
29 let s:runner_exe = gutentags#get_plat_file('update_tags') | 33 let s:runner_exe = gutentags#get_plat_file('update_tags') |
30 | 34 |
31 function! gutentags#ctags#init(project_root) abort | 35 function! gutentags#ctags#init(project_root) abort |
32 " Figure out the path to the tags file. | 36 " Figure out the path to the tags file. |
37 if g:gutentags_ctags_no_space_in_paths | |
38 " We need to replace spaces in the project root because `ctags` seems | |
39 " incapable of reading/writing to tags files with spaces. | |
40 let l:fixed_project_root = tr(a:project_root, ' ', '_') | |
41 else | |
42 let l:fixed_project_root = a:project_root | |
43 endif | |
33 let b:gutentags_files['ctags'] = gutentags#get_cachefile( | 44 let b:gutentags_files['ctags'] = gutentags#get_cachefile( |
34 \a:project_root, g:gutentags_tagfile) | 45 \l:fixed_project_root, g:gutentags_tagfile) |
35 | 46 |
36 " Set the tags file for Vim to use. | 47 " Set the tags file for Vim to use. |
37 if g:gutentags_auto_set_tags | 48 if g:gutentags_auto_set_tags |
38 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) | 49 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) |
39 endif | 50 endif |