Mercurial > vim-gutentags
annotate plugin/gutentags.vim @ 147:d566ec6cd2f7
Merge changes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 26 Nov 2016 16:33:41 -0800 |
parents | 7bc4df0225d1 3459a2522a3b |
children | f915393ff68d |
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> |
3 " Version: 0.0.1 | |
4 | |
5 " Globals {{{ | |
6 | |
92
6bbed9e4c01e
Using `:!start /b` actually requires Vim 7.4.
Ludovic Chabant <ludovic@chabant.com>
parents:
89
diff
changeset
|
7 if v:version < 704 |
6bbed9e4c01e
Using `:!start /b` actually requires Vim 7.4.
Ludovic Chabant <ludovic@chabant.com>
parents:
89
diff
changeset
|
8 echoerr "gutentags: this plugin requires vim >= 7.4." |
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
|
9 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
|
10 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
|
11 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
12 let g:gutentags_debug = get(g:, 'gutentags_debug', 0) |
0 | 13 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
14 if (exists('g:loaded_gutentags') || &cp) && !g:gutentags_debug |
0 | 15 finish |
16 endif | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
17 if (exists('g:loaded_gutentags') && g:gutentags_debug) |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
18 echom "Reloaded gutentags." |
0 | 19 endif |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
20 let g:loaded_gutentags = 1 |
0 | 21 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 |
141
7bc4df0225d1
Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents:
136
diff
changeset
|
29 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
|
30 \get(g:, 'gutentags_enabled_user_func', '')) |
7bc4df0225d1
Add support for specifying buffer-specific tagfiles.
Ludovic Chabant <ludovic@chabant.com>
parents:
136
diff
changeset
|
31 |
128
e673026faa56
Add option to not append the default project root markers.
Ludovic Chabant <ludovic@chabant.com>
parents:
120
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 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
|
36 endif |
146
3459a2522a3b
Enable Project Root Finder
thecontinium <thecontinium@outlook.com>
parents:
136
diff
changeset
|
37 |
3459a2522a3b
Enable Project Root Finder
thecontinium <thecontinium@outlook.com>
parents:
136
diff
changeset
|
38 let g:gutentags_project_root_finder = get(g:, 'gutentags_project_root_finder', '') |
0 | 39 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
44 let g:gutentags_exclude = get(g:, 'gutentags_exclude', []) |
120
5776acb079cf
Merge pull request #84 from GitHub.
Ludovic Chabant <ludovic@chabant.com>
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 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
|
49 let g:gutentags_generate_on_write = get(g:, 'gutentags_generate_on_write', 1) |
136
286e5b3095d0
Allow restricting tag generation to files listed by custom commands
Stephen Kent <smkent@smkent.net>
parents:
132
diff
changeset
|
50 let g:gutentags_file_list_command = get(g:, 'gutentags_file_list_command', '') |
3 | 51 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
52 if !exists('g:gutentags_cache_dir') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
53 let g:gutentags_cache_dir = '' |
19
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
54 else |
76
fa749380e05a
Make sure we expand the cache directory before we auto-create it.
Ludovic Chabant <ludovic@chabant.com>
parents:
75
diff
changeset
|
55 " 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
|
56 " 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
|
57 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
|
58 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
|
59 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
60 |
119
a66d90fd758b
expand() g:gutentags_ctags_executable
Justin M. Keyes <justinkz@gmail.com>
parents:
92
diff
changeset
|
61 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
|
62 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
63 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
|
64 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
|
65 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
66 |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
67 if has('win32') |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 else |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 endif |
0 | 76 |
77 " }}} | |
78 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
79 " Gutentags Setup {{{ |
0 | 80 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
81 augroup gutentags_detect |
0 | 82 autocmd! |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
83 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
|
84 autocmd VimEnter * if expand('<amatch>')==''|call gutentags#setup_gutentags()|endif |
0 | 85 augroup end |
86 | |
87 " }}} | |
88 | |
3 | 89 " Toggles and Miscellaneous Commands {{{ |
0 | 90 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
91 command! GutentagsUnlock :call gutentags#delete_lock_files() |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
92 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
93 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
|
94 command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled |
54
50d2a7cbf7c8
Fix the `GutentagsToggleTrace` command.
Ludovic Chabant <ludovic@chabant.com>
parents:
51
diff
changeset
|
95 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
|
96 endif |
0 | 97 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
98 if g:gutentags_debug |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
99 command! GutentagsToggleFake :call gutentags#fake() |
10
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
100 endif |
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
101 |
0 | 102 " }}} |
103 |