Mercurial > vim-gutentags
annotate plugin/gutentags.vim @ 118:2838af9ff980
Add `g:gutentags_exclude_project_root`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 05 Apr 2016 21:58:15 -0700 |
parents | 6bbed9e4c01e |
children | 5776acb079cf |
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 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
12 if !exists('g:gutentags_debug') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
13 let g:gutentags_debug = 0 |
0 | 14 endif |
15 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
16 if (exists('g:loaded_gutentags') || &cp) && !g:gutentags_debug |
0 | 17 finish |
18 endif | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
19 if (exists('g:loaded_gutentags') && g:gutentags_debug) |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
20 echom "Reloaded gutentags." |
0 | 21 endif |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
22 let g:loaded_gutentags = 1 |
0 | 23 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
24 if !exists('g:gutentags_trace') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
25 let g:gutentags_trace = 0 |
0 | 26 endif |
27 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
28 if !exists('g:gutentags_fake') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
29 let g:gutentags_fake = 0 |
0 | 30 endif |
31 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
32 if !exists('g:gutentags_background_update') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
33 let g:gutentags_background_update = 1 |
0 | 34 endif |
35 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
36 if !exists('g:gutentags_pause_after_update') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
37 let g:gutentags_pause_after_update = 0 |
11
478638833c3b
Fix Win32 update script, add option to pause it.
Ludovic Chabant <ludovic@chabant.com>
parents:
10
diff
changeset
|
38 endif |
478638833c3b
Fix Win32 update script, add option to pause it.
Ludovic Chabant <ludovic@chabant.com>
parents:
10
diff
changeset
|
39 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
40 if !exists('g:gutentags_enabled') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
41 let g:gutentags_enabled = 1 |
0 | 42 endif |
43 | |
88
073e63cc0456
Add `gutentags_enabled_user_func` callback.
Ludovic Chabant <ludovic@chabant.com>
parents:
85
diff
changeset
|
44 if !exists('g:gutentags_enabled_user_func') |
073e63cc0456
Add `gutentags_enabled_user_func` callback.
Ludovic Chabant <ludovic@chabant.com>
parents:
85
diff
changeset
|
45 let g:gutentags_enabled_user_func = '' |
073e63cc0456
Add `gutentags_enabled_user_func` callback.
Ludovic Chabant <ludovic@chabant.com>
parents:
85
diff
changeset
|
46 endif |
073e63cc0456
Add `gutentags_enabled_user_func` callback.
Ludovic Chabant <ludovic@chabant.com>
parents:
85
diff
changeset
|
47 |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
48 if !exists('g:gutentags_modules') |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
49 let g:gutentags_modules = ['ctags'] |
0 | 50 endif |
51 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
52 if !exists('g:gutentags_project_root') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
53 let g:gutentags_project_root = [] |
0 | 54 endif |
77
892da510cdd2
Add default project root markers for Fossil (https://www.fossil-scm.org)
pitchforks <pitchforks@users.noreply.github.com>
parents:
54
diff
changeset
|
55 let g:gutentags_project_root += ['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout'] |
0 | 56 |
89
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
57 if !exists('g:gutentags_project_info') |
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
58 let g:gutentags_project_info = [] |
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
59 endif |
8bf96f9f649c
Add support for project types.
Ludovic Chabant <ludovic@chabant.com>
parents:
88
diff
changeset
|
60 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
|
61 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
|
62 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
63 if !exists('g:gutentags_exclude') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
64 let g:gutentags_exclude = [] |
3 | 65 endif |
66 | |
118
2838af9ff980
Add `g:gutentags_exclude_project_root`.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
67 if !exists('g:gutentags_exclude_project_root') |
2838af9ff980
Add `g:gutentags_exclude_project_root`.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
68 let g:gutentags_exclude_project_root = ['/usr/local'] |
2838af9ff980
Add `g:gutentags_exclude_project_root`.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
69 endif |
2838af9ff980
Add `g:gutentags_exclude_project_root`.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
70 |
85
0424970d81f8
Add a `g:gutentags_resolve_symlinks` option to resolve symlinks at setup time.
Ludovic Chabant <ludovic@chabant.com>
parents:
78
diff
changeset
|
71 if !exists('g:gutentags_resolve_symlinks') |
0424970d81f8
Add a `g:gutentags_resolve_symlinks` option to resolve symlinks at setup time.
Ludovic Chabant <ludovic@chabant.com>
parents:
78
diff
changeset
|
72 let g:gutentags_resolve_symlinks = 0 |
0424970d81f8
Add a `g:gutentags_resolve_symlinks` option to resolve symlinks at setup time.
Ludovic Chabant <ludovic@chabant.com>
parents:
78
diff
changeset
|
73 endif |
0424970d81f8
Add a `g:gutentags_resolve_symlinks` option to resolve symlinks at setup time.
Ludovic Chabant <ludovic@chabant.com>
parents:
78
diff
changeset
|
74 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
75 if !exists('g:gutentags_generate_on_new') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
76 let g:gutentags_generate_on_new = 1 |
14
b8f23bf7b20f
Ability to (re)generate tags when opening a new project.
Ludovic Chabant <ludovic@chabant.com>
parents:
11
diff
changeset
|
77 endif |
b8f23bf7b20f
Ability to (re)generate tags when opening a new project.
Ludovic Chabant <ludovic@chabant.com>
parents:
11
diff
changeset
|
78 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
79 if !exists('g:gutentags_generate_on_missing') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
80 let g:gutentags_generate_on_missing = 1 |
3 | 81 endif |
82 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
83 if !exists('g:gutentags_generate_on_write') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
84 let g:gutentags_generate_on_write = 1 |
3 | 85 endif |
86 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
87 if !exists('g:gutentags_cache_dir') |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
88 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
|
89 else |
76
fa749380e05a
Make sure we expand the cache directory before we auto-create it.
Ludovic Chabant <ludovic@chabant.com>
parents:
75
diff
changeset
|
90 " 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
|
91 " 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
|
92 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
|
93 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
|
94 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
95 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
96 if !exists('g:gutentags_define_advanced_commands') |
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
97 let g:gutentags_define_advanced_commands = 0 |
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
98 endif |
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
99 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
100 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
|
101 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
|
102 endif |
d48b0e48283b
Add support for storing tags files out of the way.
Ludovic Chabant <ludovic@chabant.com>
parents:
16
diff
changeset
|
103 |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
104 if has('win32') |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
105 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
|
106 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
|
107 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
|
108 else |
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 endif |
0 | 113 |
114 " }}} | |
115 | |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
116 " Gutentags Setup {{{ |
0 | 117 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
118 augroup gutentags_detect |
0 | 119 autocmd! |
41
99328cb71e75
Refactor Gutentags so functionality can be implemented in "modules".
Ludovic Chabant <ludovic@chabant.com>
parents:
40
diff
changeset
|
120 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
|
121 autocmd VimEnter * if expand('<amatch>')==''|call gutentags#setup_gutentags()|endif |
0 | 122 augroup end |
123 | |
124 " }}} | |
125 | |
3 | 126 " Toggles and Miscellaneous Commands {{{ |
0 | 127 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
128 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
|
129 |
46
c0f56e4d52bd
Make a bunch of advanced commands opt-in only.
Ludovic Chabant <ludovic@chabant.com>
parents:
41
diff
changeset
|
130 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
|
131 command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled |
54
50d2a7cbf7c8
Fix the `GutentagsToggleTrace` command.
Ludovic Chabant <ludovic@chabant.com>
parents:
51
diff
changeset
|
132 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
|
133 endif |
0 | 134 |
22
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
135 if g:gutentags_debug |
4e1b0253f71a
Renamed project to "Gutentags" (thanks Sylvain!).
Ludovic Chabant <ludovic@chabant.com>
parents:
21
diff
changeset
|
136 command! GutentagsToggleFake :call gutentags#fake() |
10
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
137 endif |
b853ad0e7afd
Only define `:AutotagsToggleFake` if debug mode is on.
Ludovic Chabant <ludovic@chabant.com>
parents:
9
diff
changeset
|
138 |
0 | 139 " }}} |
140 |