annotate autoload/gutentags/ctags.vim @ 170:0e7ffc799cc5

Escape reserved Vim patterns in wildignore entries.
author Thaer <thaer.khawaja@gmail.com>
date Sun, 05 Feb 2017 22:32:56 -0800
parents 34c57ad6eb45
children 18df731b1563
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 " Ctags module for Gutentags
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 " Global Options {{{
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4
119
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
5 let g:gutentags_ctags_executable = get(g:, 'gutentags_ctags_executable', 'ctags')
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
6 let g:gutentags_ctags_tagfile = get(g:, 'gutentags_ctags_tagfile', 'tags')
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
7 let g:gutentags_ctags_auto_set_tags = get(g:, 'gutentags_ctags_auto_set_tags', 1)
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
8
119
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
9 let g:gutentags_ctags_options_file = get(g:, 'gutentags_ctags_options_file', '.gutctags')
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
10 let g:gutentags_ctags_check_tagfile = get(g:, 'gutentags_ctags_check_tagfile', 0)
160
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
11 let g:gutentags_ctags_extra_args = get(g:, 'gutentags_ctags_extra_args', [])
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
12 let g:gutentags_ctags_post_process_cmd = get(g:, 'gutentags_ctags_post_process_cmd', '')
86
7872cc9bbc2d Check existing tags file as an opt-in thing for now.
Ludovic Chabant <ludovic@chabant.com>
parents: 84
diff changeset
13
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
14 let g:gutentags_ctags_exclude = get(g:, 'gutentags_ctags_exclude', [])
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
15 let g:gutentags_ctags_exclude_wildignore = get(g:, 'gutentags_ctags_exclude_wildignore', 1)
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
16
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
17 " Backwards compatibility.
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
18 function! s:_handleOldOptions() abort
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
19 let l:renamed_options = {
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
20 \'gutentags_exclude': 'gutentags_ctags_exclude',
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
21 \'gutentags_tagfile': 'gutentags_ctags_tagfile',
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
22 \'gutentags_auto_set_tags': 'gutentags_ctags_auto_set_tags'
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
23 \}
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
24 for key in keys(l:renamed_options)
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
25 if exists('g:'.key)
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
26 let newname = l:renamed_options[key]
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
27 echom "gutentags: Option 'g:'".key." has been renamed to ".
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
28 \"'g:'".newname." Please update your vimrc."
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
29 let g:[newname] = g:[key]
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
30 endif
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
31 endfor
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
32 endfunction
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
33 call s:_handleOldOptions()
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
34 " }}}
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
35
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
36 " Gutentags Module Interface {{{
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
37
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
38 let s:runner_exe = gutentags#get_plat_file('update_tags')
115
bc6ef3d0b84f ctags: fix output redirection on tcsh
Ilya Tumaykin <itumaykin@gmail.com>
parents: 114
diff changeset
39 let s:unix_redir = (&shellredir =~# '%s') ? &shellredir : &shellredir . ' %s'
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
40
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
41 function! gutentags#ctags#init(project_root) abort
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
42 " Figure out the path to the tags file.
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
43 " Check the old name for this option, too, before falling back to the
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
44 " globally defined name.
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
45 let l:tagfile = getbufvar("", 'gutentags_ctags_tagfile',
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
46 \getbufvar("", 'gutentags_tagfile',
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
47 \g:gutentags_ctags_tagfile))
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
48 let b:gutentags_files['ctags'] = gutentags#get_cachefile(
141
7bc4df0225d1 Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents: 136
diff changeset
49 \a:project_root, l:tagfile)
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
50
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
51 " Set the tags file for Vim to use.
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
52 if g:gutentags_ctags_auto_set_tags
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
53 execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags'])
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
54 endif
93
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
55
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
56 " Check if the ctags executable exists.
119
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
57 if g:gutentags_enabled && executable(expand(g:gutentags_ctags_executable, 1)) == 0
93
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
58 let g:gutentags_enabled = 0
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
59 echoerr "Executable '".g:gutentags_ctags_executable."' can't be found. "
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
60 \."Gutentags will be disabled. You can re-enable it by "
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
61 \."setting g:gutentags_enabled back to 1."
edd488d8d37e Give some error message if there's no available `ctags` on the system.
Ludovic Chabant <ludovic@chabant.com>
parents: 89
diff changeset
62 endif
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
63 endfunction
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
64
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
65 function! gutentags#ctags#generate(proj_dir, tags_file, write_mode) abort
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
66 " Get to the tags file directory because ctags is finicky about
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
67 " these things.
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
68 let l:prev_cwd = getcwd()
158
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
69 execute "chdir " . fnameescape(a:proj_dir)
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
70
84
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
71 let l:tags_file_exists = filereadable(a:tags_file)
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
72
86
7872cc9bbc2d Check existing tags file as an opt-in thing for now.
Ludovic Chabant <ludovic@chabant.com>
parents: 84
diff changeset
73 if l:tags_file_exists && g:gutentags_ctags_check_tagfile
84
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
74 let l:first_lines = readfile(a:tags_file, '', 1)
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
75 if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0
148
b178f2251982 Only set `v:errmsg` when we throw an actual error.
Ludovic Chabant <ludovic@chabant.com>
parents: 141
diff changeset
76 call gutentags#throwerr(
b178f2251982 Only set `v:errmsg` when we throw an actual error.
Ludovic Chabant <ludovic@chabant.com>
parents: 141
diff changeset
77 \"File ".a:tags_file." doesn't appear to be ".
84
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
78 \"a ctags file. Please delete it and run ".
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
79 \":GutentagsUpdate!.")
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
80 return
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
81 endif
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
82 endif
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
83
116
be8d47e88ab1 ctags: use empty() instead of comparing with ""
Ilya Tumaykin <itumaykin@gmail.com>
parents: 115
diff changeset
84 if empty(g:gutentags_cache_dir)
167
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
85 " If we don't use the cache directory, we can pass relative paths
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
86 " around.
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
87 "
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
88 " Note that if we don't do this and pass a full path for the project
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
89 " root, some `ctags` implementations like Exhuberant Ctags can get
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
90 " confused if the paths have spaces -- but not if you're *in* the root
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
91 " directory, for some reason...
98
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
92 let l:actual_proj_dir = '.'
167
34c57ad6eb45 Always use the potentially custom name for the tags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 165
diff changeset
93 let l:actual_tags_file = fnamemodify(a:tags_file, ':.')
98
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
94 else
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
95 " else: the tags file goes in a cache directory, so we need to specify
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
96 " all the paths absolutely for `ctags` to do its job correctly.
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
97 let l:actual_proj_dir = a:proj_dir
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
98 let l:actual_tags_file = a:tags_file
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
99 endif
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
100
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
101 try
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
102 " Build the command line.
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
103 let l:cmd = gutentags#get_execute_cmd() . s:runner_exe
89
8bf96f9f649c Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents: 86
diff changeset
104 let l:cmd .= ' -e "' . s:get_ctags_executable(a:proj_dir) . '"'
98
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
105 let l:cmd .= ' -t "' . l:actual_tags_file . '"'
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
106 let l:cmd .= ' -p "' . l:actual_proj_dir . '"'
84
96bfe5c37f37 Error and abort if we'll be overwriting a non-ctags file.
Ludovic Chabant <ludovic@chabant.com>
parents: 75
diff changeset
107 if a:write_mode == 0 && l:tags_file_exists
133
6f15299869fc Don't pass absolute paths to `ctags` when we want relative paths from it.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
108 let l:cur_file_path = expand('%:p')
6f15299869fc Don't pass absolute paths to `ctags` when we want relative paths from it.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
109 if empty(g:gutentags_cache_dir)
6f15299869fc Don't pass absolute paths to `ctags` when we want relative paths from it.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
110 let l:cur_file_path = fnamemodify(l:cur_file_path, ':.')
6f15299869fc Don't pass absolute paths to `ctags` when we want relative paths from it.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
111 endif
6f15299869fc Don't pass absolute paths to `ctags` when we want relative paths from it.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
112 let l:cmd .= ' -s "' . l:cur_file_path . '"'
136
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
113 else
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
114 let l:file_list_cmd = gutentags#get_project_file_list_cmd(l:actual_proj_dir)
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
115 if !empty(l:file_list_cmd)
158
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
116 let l:suffopts = matchstrpos(l:file_list_cmd, '///')
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
117 if l:suffopts[1] > 0
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
118 let l:suffoptstr = strpart(l:file_list_cmd, l:suffopts[2])
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
119 let l:file_list_cmd = strpart(l:file_list_cmd, 0, l:suffopts[1])
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
120 if l:suffoptstr == 'absolute'
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
121 let l:cmd .= ' -A'
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
122 endif
bba76de4371a Add option to specify that a custom file lister returns absolute paths.
Ludovic Chabant <ludovic@chabant.com>
parents: 148
diff changeset
123 endif
136
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
124 let l:cmd .= ' -L ' . '"' . l:file_list_cmd. '"'
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
125 endif
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
126 endif
136
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
127 if empty(get(l:, 'file_list_cmd', ''))
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
128 " Pass the Gutentags recursive options file before the project
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
129 " options file, so that users can override --recursive.
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
130 " Omit --recursive if this project uses a file list command.
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
131 let l:cmd .= ' -o "' . gutentags#get_res_file('ctags_recursive.options') . '"'
286e5b3095d0 Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents: 135
diff changeset
132 endif
160
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
133 if !empty(g:gutentags_ctags_extra_args)
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
134 let l:cmd .= ' -O '.shellescape(join(g:gutentags_ctags_extra_args))
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
135 endif
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
136 if !empty(g:gutentags_ctags_post_process_cmd)
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
137 let l:cmd .= ' -P '.shellescape(g:gutentags_ctags_post_process_cmd)
1b980f5071a0 Post-processing for `tags` files, extra args for `ctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 158
diff changeset
138 endif
114
979fab641f29 ctags: remove trailing space
Ilya Tumaykin <itumaykin@gmail.com>
parents: 113
diff changeset
139 let l:proj_options_file = a:proj_dir . '/' .
75
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
140 \g:gutentags_ctags_options_file
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
141 if filereadable(l:proj_options_file)
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
142 let l:proj_options_file = s:process_options_file(
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
143 \a:proj_dir, l:proj_options_file)
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
144 let l:cmd .= ' -o "' . l:proj_options_file . '"'
d12543f11eb9 Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents: 70
diff changeset
145 endif
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
146 if g:gutentags_ctags_exclude_wildignore
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
147 for ign in split(&wildignore, ',')
170
0e7ffc799cc5 Escape reserved Vim patterns in wildignore entries.
Thaer <thaer.khawaja@gmail.com>
parents: 167
diff changeset
148 let l:cmd .= ' -x ' . shellescape(ign, 1)
165
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
149 endfor
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
150 endif
cbc1ebe23ef1 Rename all ctags-related options to have "ctags" in their name.
Ludovic Chabant <ludovic@chabant.com>
parents: 160
diff changeset
151 for exc in g:gutentags_ctags_exclude
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
152 let l:cmd .= ' -x ' . '"' . exc . '"'
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
153 endfor
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
154 if g:gutentags_pause_after_update
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
155 let l:cmd .= ' -c'
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
156 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
157 if g:gutentags_trace
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
158 if has('win32')
98
d645125192aa Fix more problems with paths and spaces in them.
Ludovic Chabant <ludovic@chabant.com>
parents: 96
diff changeset
159 let l:cmd .= ' -l "' . l:actual_tags_file . '.log"'
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
160 else
115
bc6ef3d0b84f ctags: fix output redirection on tcsh
Ilya Tumaykin <itumaykin@gmail.com>
parents: 114
diff changeset
161 let l:cmd .= ' ' . printf(s:unix_redir, '"' . l:actual_tags_file . '.log"')
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
162 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
163 else
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
164 if !has('win32')
115
bc6ef3d0b84f ctags: fix output redirection on tcsh
Ilya Tumaykin <itumaykin@gmail.com>
parents: 114
diff changeset
165 let l:cmd .= ' ' . printf(s:unix_redir, '/dev/null')
41
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
166 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
167 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
168 let l:cmd .= gutentags#get_execute_cmd_suffix()
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
169
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
170 call gutentags#trace("Running: " . l:cmd)
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
171 call gutentags#trace("In: " . getcwd())
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
172 if !g:gutentags_fake
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
173 " Run the background process.
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
174 if !g:gutentags_trace
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
175 silent execute l:cmd
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
176 else
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
177 execute l:cmd
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
178 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
179
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
180 " Flag this tags file as being in progress
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
181 let l:full_tags_file = fnamemodify(a:tags_file, ':p')
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
182 call gutentags#add_progress('ctags', l:full_tags_file)
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
183 else
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
184 call gutentags#trace("(fake... not actually running)")
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
185 endif
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
186 call gutentags#trace("")
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
187 finally
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
188 " Restore the previous working directory.
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
189 execute "chdir " . fnameescape(l:prev_cwd)
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
190 endtry
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
191 endfunction
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
192
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
193 " }}}
99328cb71e75 Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
194
62
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
195 " Utilities {{{
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
196
70
661a97eaf608 Move `get_ctags_executable` to the `ctags` module.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
197 " Get final ctags executable depending whether a filetype one is defined
89
8bf96f9f649c Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents: 86
diff changeset
198 function! s:get_ctags_executable(proj_dir) abort
70
661a97eaf608 Move `get_ctags_executable` to the `ctags` module.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
199 "Only consider the main filetype in cases like 'python.django'
661a97eaf608 Move `get_ctags_executable` to the `ctags` module.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
200 let l:ftype = get(split(&filetype, '\.'), 0, '')
89
8bf96f9f649c Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents: 86
diff changeset
201 let l:proj_info = gutentags#get_project_info(a:proj_dir)
8bf96f9f649c Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents: 86
diff changeset
202 let l:type = get(l:proj_info, 'type', l:ftype)
119
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
203 let exepath = exists('g:gutentags_ctags_executable_{l:type}')
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
204 \ ? g:gutentags_ctags_executable_{l:type} : g:gutentags_ctags_executable
a66d90fd758b expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents: 117
diff changeset
205 return expand(exepath, 1)
70
661a97eaf608 Move `get_ctags_executable` to the `ctags` module.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
206 endfunction
661a97eaf608 Move `get_ctags_executable` to the `ctags` module.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
207
62
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
208 function! s:process_options_file(proj_dir, path) abort
116
be8d47e88ab1 ctags: use empty() instead of comparing with ""
Ilya Tumaykin <itumaykin@gmail.com>
parents: 115
diff changeset
209 if empty(g:gutentags_cache_dir)
62
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
210 " If we're not using a cache directory to store tag files, we can
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
211 " use the options file straight away.
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
212 return a:path
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
213 endif
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
214
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
215 " See if we need to process the options file.
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
216 let l:do_process = 0
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
217 let l:proj_dir = gutentags#stripslash(a:proj_dir)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
218 let l:out_path = gutentags#get_cachefile(l:proj_dir, 'options')
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
219 if !filereadable(l:out_path)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
220 call gutentags#trace("Processing options file '".a:path."' because ".
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
221 \"it hasn't been processed yet.")
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
222 let l:do_process = 1
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
223 elseif getftime(a:path) > getftime(l:out_path)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
224 call gutentags#trace("Processing options file '".a:path."' because ".
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
225 \"it has changed.")
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
226 let l:do_process = 1
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
227 endif
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
228 if l:do_process == 0
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
229 " Nothing's changed, return the existing processed version of the
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
230 " options file.
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
231 return l:out_path
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
232 endif
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
233
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
234 " We have to process the options file. Right now this only means capturing
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
235 " all the 'exclude' rules, and rewrite them to make them absolute.
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
236 "
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
237 " This is because since `ctags` is run with absolute paths (because we
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
238 " want the tag file to be in a cache directory), it will do its path
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
239 " matching with absolute paths too, so the exclude rules need to be
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
240 " absolute.
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
241 let l:lines = readfile(a:path)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
242 let l:outlines = []
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
243 for line in l:lines
99
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
244 let l:exarg_idx = matchend(line, '\v^\-\-exclude=')
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
245 if l:exarg_idx < 0
62
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
246 call add(l:outlines, line)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
247 continue
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
248 endif
99
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
249
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
250 " Don't convert things that don't look like paths.
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
251 let l:exarg = strpart(line, l:exarg_idx + 1)
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
252 let l:do_convert = 1
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
253 if l:exarg[0] == '@' " Manifest file path
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
254 let l:do_convert = 0
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
255 endif
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
256 if stridx(l:exarg, '/') < 0 && stridx(l:exarg, '\\') < 0 " Filename
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
257 let l:do_convert = 0
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
258 endif
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
259 if l:do_convert == 0
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
260 call add(l:outlines, line)
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
261 continue
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
262 endif
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
263
05fc1e2172cc Fixes in the processing of `.gutctags`.
Ludovic Chabant <ludovic@chabant.com>
parents: 98
diff changeset
264 let l:fullp = l:proj_dir . gutentags#normalizepath('/'.l:exarg)
62
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
265 let l:ol = '--exclude='.l:fullp
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
266 call add(l:outlines, l:ol)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
267 endfor
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
268
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
269 call writefile(l:outlines, l:out_path)
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
270 return l:out_path
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
271 endfunction
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
272
106757c129cb Change the per-project option file to be `.gutctags` and process it first.
Ludovic Chabant <ludovic@chabant.com>
parents: 60
diff changeset
273 " }}}