Mercurial > vim-gutentags
annotate plugin/gutentags.vim @ 235:def58b9d22c6
Exclude cscope from default file list command
With default setup gutentags generate file list for cscope using simple
`find -type f` command in update_scopedb.sh. Subsequent invocations of
this script causes unbounded growth of cscope database because cscope
indexes itself every time.
This change excludes cscope database file from default file list command
for cscope database generation so it will work properly by default.
Another option is to use custom file list command like `ag -l` that will
generate files known to source control, that is without cscope database
file.
author | Alex Dzyoba <alex@dzyoba.com> |
---|---|
date | Tue, 18 Dec 2018 23:32:20 +0300 |
parents | 34bee0477b51 |
children | 050d0549ecf3 |
rev | line source |
---|---|
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
1 " gutentags.vim - Automatic ctags management for Vim |
0 | 2 " Maintainer: Ludovic Chabant <http://ludovic.chabant.com> |
202
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
3 " Version: 2.0.0 |
0 | 4 |
5 " Globals {{{ | |
6 | |
149
f915393ff68d
Add `g:gutentags_dont_load` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
147
diff
changeset
|
7 if (&cp || get(g:, 'gutentags_dont_load', 0)) |
f915393ff68d
Add `g:gutentags_dont_load` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
147
diff
changeset
|
8 finish |
f915393ff68d
Add `g:gutentags_dont_load` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
147
diff
changeset
|
9 endif |
f915393ff68d
Add `g:gutentags_dont_load` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
147
diff
changeset
|
10 |
208
18dbf8d02b4c
Lower Vim version requirement since we also check for the job API directly.
Ludovic Chabant <ludovic@chabant.com>
parents:
202
diff
changeset
|
11 if v:version < 704 |
18dbf8d02b4c
Lower Vim version requirement since we also check for the job API directly.
Ludovic Chabant <ludovic@chabant.com>
parents:
202
diff
changeset
|
12 echoerr "gutentags: this plugin requires vim >= 7.4." |
202
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
13 finish |
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
14 endif |
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
15 |
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
16 if !(has('job') || (has('nvim') && exists('*jobwait'))) |
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
17 echoerr "gutentags: this plugin requires the job API from Vim8 or Neovim." |
50
ea7780912296
Check for Vim 7.4 since bug reports indicate Gutentags may not work in 7.3.
Ludovic Chabant <ludovic@chabant.com>
parents:
46
diff
changeset
|
18 finish |
ea7780912296
Check for Vim 7.4 since bug reports indicate Gutentags may not work in 7.3.
Ludovic Chabant <ludovic@chabant.com>
parents:
46
diff
changeset
|
19 endif |
ea7780912296
Check for Vim 7.4 since bug reports indicate Gutentags may not work in 7.3.
Ludovic Chabant <ludovic@chabant.com>
parents:
46
diff
changeset
|
20 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
21 let g:gutentags_debug = get(g:, 'gutentags_debug', 0) |
0 | 22 |
149
f915393ff68d
Add `g:gutentags_dont_load` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
147
diff
changeset
|
23 if (exists('g:loaded_gutentags') && !g:gutentags_debug) |
0 | 24 finish |
25 endif | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
26 if (exists('g:loaded_gutentags') && g:gutentags_debug) |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
27 echom "Reloaded gutentags." |
0 | 28 endif |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
29 let g:loaded_gutentags = 1 |
0 | 30 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
31 let g:gutentags_trace = get(g:, 'gutentags_trace', 0) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
32 let g:gutentags_fake = get(g:, 'gutentags_fake', 0) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
33 let g:gutentags_background_update = get(g:, 'gutentags_background_update', 1) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
34 let g:gutentags_pause_after_update = get(g:, 'gutentags_pause_after_update', 0) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
35 let g:gutentags_enabled = get(g:, 'gutentags_enabled', 1) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
36 let g:gutentags_modules = get(g:, 'gutentags_modules', ['ctags']) |
11
478638833c3b
Fix Win32 update script, add option to pause it.
Ludovic Chabant <ludovic@chabant.com>
parents:
10
diff
changeset
|
37 |
141
7bc4df0225d1
Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents:
136
diff
changeset
|
38 let g:gutentags_init_user_func = get(g:, 'gutentags_init_user_func', |
7bc4df0225d1
Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents:
136
diff
changeset
|
39 \get(g:, 'gutentags_enabled_user_func', '')) |
7bc4df0225d1
Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents:
136
diff
changeset
|
40 |
128
e673026faa56
Add option to not append the default project root markers.
Ludovic Chabant <ludovic@chabant.com>
parents:
120
diff
changeset
|
41 let g:gutentags_add_default_project_roots = get(g:, 'gutentags_add_default_project_roots', 1) |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
42 let g:gutentags_project_root = get(g:, 'gutentags_project_root', []) |
128
e673026faa56
Add option to not append the default project root markers.
Ludovic Chabant <ludovic@chabant.com>
parents:
120
diff
changeset
|
43 if g:gutentags_add_default_project_roots |
e673026faa56
Add option to not append the default project root markers.
Ludovic Chabant <ludovic@chabant.com>
parents:
120
diff
changeset
|
44 let g:gutentags_project_root += ['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout'] |
e673026faa56
Add option to not append the default project root markers.
Ludovic Chabant <ludovic@chabant.com>
parents:
120
diff
changeset
|
45 endif |
146
3459a2522a3b
Enable Project Root Finder
thecontinium <thecontinium@outlook.com>
parents:
136
diff
changeset
|
46 |
3459a2522a3b
Enable Project Root Finder
thecontinium <thecontinium@outlook.com>
parents:
136
diff
changeset
|
47 let g:gutentags_project_root_finder = get(g:, 'gutentags_project_root_finder', '') |
0 | 48 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
49 let g:gutentags_project_info = get(g:, 'gutentags_project_info', []) |
89
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
50 call add(g:gutentags_project_info, {'type': 'python', 'file': 'setup.py'}) |
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
51 call add(g:gutentags_project_info, {'type': 'ruby', 'file': 'Gemfile'}) |
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
52 |
229
34bee0477b51
Add `g:gutentags_exclude_filetypes` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
208
diff
changeset
|
53 let g:gutentags_exclude_filetypes = get(g:, 'gutentags_exclude_filetypes', []) |
120
5776acb079cf
Merge pull request #84 from GitHub.
Ludovic Chabant <ludovic@chabant.com>
diff
changeset
|
54 let g:gutentags_exclude_project_root = get(g:, 'gutentags_exclude_project_root', ['/usr/local']) |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
55 let g:gutentags_resolve_symlinks = get(g:, 'gutentags_resolve_symlinks', 0) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
56 let g:gutentags_generate_on_new = get(g:, 'gutentags_generate_on_new', 1) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
57 let g:gutentags_generate_on_missing = get(g:, 'gutentags_generate_on_missing', 1) |
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
58 let g:gutentags_generate_on_write = get(g:, 'gutentags_generate_on_write', 1) |
182
2489b4b54d5c
Add `g:gutentags_generate_on_empty_buffer` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
165
diff
changeset
|
59 let g:gutentags_generate_on_empty_buffer = get(g:, 'gutentags_generate_on_empty_buffer', 0) |
136
286e5b3095d0
Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents:
132
diff
changeset
|
60 let g:gutentags_file_list_command = get(g:, 'gutentags_file_list_command', '') |
3 | 61 |
202
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
62 let g:gutentags_use_jobs = get(g:, 'gutentags_use_jobs', has('job')) |
b50b6d0f82dd
Refactor for Vim8/Neovim job support.
Ludovic Chabant <ludovic@chabant.com>
parents:
182
diff
changeset
|
63 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
64 if !exists('g:gutentags_cache_dir') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
65 let g:gutentags_cache_dir = '' |
159
41fa23706d9c
Don't use the cache directory if it's set as an empty string.
Ludovic Chabant <ludovic@chabant.com>
parents:
149
diff
changeset
|
66 elseif !empty(g:gutentags_cache_dir) |
76
fa749380e05a
Make sure we expand the cache directory before we auto-create it.
Ludovic Chabant <ludovic@chabant.com>
parents:
75
diff
changeset
|
67 " Make sure we get an absolute/resolved path (e.g. expanding `~/`), and |
fa749380e05a
Make sure we expand the cache directory before we auto-create it.
Ludovic Chabant <ludovic@chabant.com>
parents:
75
diff
changeset
|
68 " strip any trailing slash. |
fa749380e05a
Make sure we expand the cache directory before we auto-create it.
Ludovic Chabant <ludovic@chabant.com>
parents:
75
diff
changeset
|
69 let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':p') |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
70 let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':s?[/\\]$??') |
19
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
71 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
72 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
73 let g:gutentags_define_advanced_commands = get(g:, 'gutentags_define_advanced_commands', 0) |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
74 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
75 if g:gutentags_cache_dir != '' && !isdirectory(g:gutentags_cache_dir) |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
76 call mkdir(g:gutentags_cache_dir, 'p') |
19
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
77 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
78 |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
79 if has('win32') |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
80 let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . "\\plat\\win32\\" |
75
d12543f11eb9
Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents:
54
diff
changeset
|
81 let g:gutentags_res_dir = expand('<sfile>:h:h:p') . "\\res\\" |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
82 let g:gutentags_script_ext = '.cmd' |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
83 else |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
84 let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . '/plat/unix/' |
75
d12543f11eb9
Move the default `-R` option to an overridable "global" options file.
Ludovic Chabant <ludovic@chabant.com>
parents:
54
diff
changeset
|
85 let g:gutentags_res_dir = expand('<sfile>:h:h:p') . '/res/' |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
86 let g:gutentags_script_ext = '.sh' |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
87 endif |
0 | 88 |
89 " }}} | |
90 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
91 " Gutentags Setup {{{ |
0 | 92 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
93 augroup gutentags_detect |
0 | 94 autocmd! |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
95 autocmd BufNewFile,BufReadPost * call gutentags#setup_gutentags() |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
96 autocmd VimEnter * if expand('<amatch>')==''|call gutentags#setup_gutentags()|endif |
0 | 97 augroup end |
98 | |
99 " }}} | |
100 | |
3 | 101 " Toggles and Miscellaneous Commands {{{ |
0 | 102 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
103 if g:gutentags_define_advanced_commands |
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
104 command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled |
54
50d2a7cbf7c8
Fix the `GutentagsToggleTrace` command.
Ludovic Chabant <ludovic@chabant.com>
parents:
51
diff
changeset
|
105 command! GutentagsToggleTrace :call gutentags#toggletrace() |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
106 endif |
0 | 107 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
108 if g:gutentags_debug |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
109 command! GutentagsToggleFake :call gutentags#fake() |
10
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
110 endif |
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
111 |
0 | 112 " }}} |
113 |