Mercurial > vim-gutentags
changeset 165:cbc1ebe23ef1
Rename all ctags-related options to have "ctags" in their name.
Add some stuff to handle old options so it doesn't break everybody.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 18 Feb 2017 18:21:35 -0800 |
parents | 28d4dae03f2a |
children | 1fe62e7f1fae |
files | autoload/gutentags/ctags.vim doc/gutentags.txt plugin/gutentags.vim |
diffstat | 3 files changed, 60 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim Sat Feb 18 18:20:51 2017 -0800 +++ b/autoload/gutentags/ctags.vim Sat Feb 18 18:21:35 2017 -0800 @@ -3,13 +3,34 @@ " Global Options {{{ let g:gutentags_ctags_executable = get(g:, 'gutentags_ctags_executable', 'ctags') -let g:gutentags_tagfile = get(g:, 'gutentags_tagfile', 'tags') -let g:gutentags_auto_set_tags = get(g:, 'gutentags_auto_set_tags', 1) +let g:gutentags_ctags_tagfile = get(g:, 'gutentags_ctags_tagfile', 'tags') +let g:gutentags_ctags_auto_set_tags = get(g:, 'gutentags_ctags_auto_set_tags', 1) + let g:gutentags_ctags_options_file = get(g:, 'gutentags_ctags_options_file', '.gutctags') let g:gutentags_ctags_check_tagfile = get(g:, 'gutentags_ctags_check_tagfile', 0) let g:gutentags_ctags_extra_args = get(g:, 'gutentags_ctags_extra_args', []) let g:gutentags_ctags_post_process_cmd = get(g:, 'gutentags_ctags_post_process_cmd', '') +let g:gutentags_ctags_exclude = get(g:, 'gutentags_ctags_exclude', []) +let g:gutentags_ctags_exclude_wildignore = get(g:, 'gutentags_ctags_exclude_wildignore', 1) + +" Backwards compatibility. +function! s:_handleOldOptions() abort + let l:renamed_options = { + \'gutentags_exclude': 'gutentags_ctags_exclude', + \'gutentags_tagfile': 'gutentags_ctags_tagfile', + \'gutentags_auto_set_tags': 'gutentags_ctags_auto_set_tags' + \} + for key in keys(l:renamed_options) + if exists('g:'.key) + let newname = l:renamed_options[key] + echom "gutentags: Option 'g:'".key." has been renamed to ". + \"'g:'".newname." Please update your vimrc." + let g:[newname] = g:[key] + endif + endfor +endfunction +call s:_handleOldOptions() " }}} " Gutentags Module Interface {{{ @@ -19,12 +40,16 @@ function! gutentags#ctags#init(project_root) abort " Figure out the path to the tags file. - let l:tagfile = getbufvar("", 'gutentags_tagfile', g:gutentags_tagfile) + " Check the old name for this option, too, before falling back to the + " globally defined name. + let l:tagfile = getbufvar("", 'gutentags_ctags_tagfile', + \getbufvar("", 'gutentags_tagfile', + \g:gutentags_ctags_tagfile)) let b:gutentags_files['ctags'] = gutentags#get_cachefile( \a:project_root, l:tagfile) " Set the tags file for Vim to use. - if g:gutentags_auto_set_tags + if g:gutentags_ctags_auto_set_tags execute 'setlocal tags^=' . fnameescape(b:gutentags_files['ctags']) endif @@ -64,7 +89,7 @@ " confused if the paths have spaces -- but not if you're *in* the " root directory. let l:actual_proj_dir = '.' - let l:actual_tags_file = g:gutentags_tagfile + let l:actual_tags_file = g:gutentags_ctags_tagfile else " else: the tags file goes in a cache directory, so we need to specify " all the paths absolutely for `ctags` to do its job correctly. @@ -117,10 +142,12 @@ \a:proj_dir, l:proj_options_file) let l:cmd .= ' -o "' . l:proj_options_file . '"' endif - for ign in split(&wildignore, ',') - let l:cmd .= ' -x ' . '"' . ign . '"' - endfor - for exc in g:gutentags_exclude + if g:gutentags_ctags_exclude_wildignore + for ign in split(&wildignore, ',') + let l:cmd .= ' -x ' . '"' . ign . '"' + endfor + endif + for exc in g:gutentags_ctags_exclude let l:cmd .= ' -x ' . '"' . exc . '"' endfor if g:gutentags_pause_after_update
--- a/doc/gutentags.txt Sat Feb 18 18:20:51 2017 -0800 +++ b/doc/gutentags.txt Sat Feb 18 18:21:35 2017 -0800 @@ -117,10 +117,10 @@ "`.notags`" at the root of the project. The tag file that Gutentags creates and manages will be named after -|gutentags_tagfile|, relative to the project's root directory. When Gutentags -finds a valid project root, it will prepend the tag file's path to 'tags', -unless |gutentags_auto_set_tags| is set to 0. This is to make sure Vim will use -that file first. +|gutentags_ctags_tagfile|, relative to the project's root directory. When +Gutentags finds a valid project root, it will prepend the tag file's path to +'tags', unless |gutentags_ctags_auto_set_tags| is set to 0. This is to make +sure Vim will use that file first. If a file managed by Gutentags is opened and no tag file already exists, Gutentags will start generating it right away in the background, unless @@ -254,8 +254,8 @@ let g:gutentags_ctags_executable_ruby = 'foobar' < - *gutentags_tagfile* -g:gutentags_tagfile + *gutentags_ctags_tagfile* +g:gutentags_ctags_tagfile Specifies the name of the tag file to create. This will be appended to the project's root. See |gutentags_project_root| for how Gutentags locates the @@ -270,8 +270,8 @@ in the current file's directory and its parent directories. If it finds any of those markers, Gutentags will be enabled for the project, and a tags - file named after |gutentags_tagfile| will be created at - the project root. + file named after |gutentags_ctags_tagfile| will be + created at the project root. Defaults to `[]` (an empty |List|). A list of default markers will be appended to the user-defined ones unless @@ -314,17 +314,25 @@ Note: when set, the called implementation will most likely ignore |g:gutentags_project_root|. - *gutentags_exclude* -g:gutentags_exclude + *gutentags_ctags_exclude* +g:gutentags_ctags_exclude A list of file patterns to pass to the |gutentags_ctags_executable| so that they will be excluded from parsing for the tags generation. - Defaults to `[]` (an empty |List|). Patterns defined - in 'wildignore' will also be given as exclude patterns - to the `ctags` executable. + See also |gutentags_ctags_exclude_wildignore|. + Defaults to `[]` (an empty |List|). - *gutentags_auto_set_tags* -g:gutentags_auto_set_tags + *gutentags_ctags_exclude_wildignore* +g:gutentags_ctags_exclude_wildignore + When 1, Gutentags will automatically pass your + 'wildignore' file patterns to the + |gutentags_ctags_executable| so that they are ignored. + Set also |gutentags_ctags_exclude| to pass custom + patterns. + Defaults to 1. + + *gutentags_ctags_auto_set_tags* +g:gutentags_ctags_auto_set_tags If set to 1, Gutentags will automatically prepend 'tags' with the exact path to the tag file for the current project. See |gutentags_project_root| for how @@ -410,7 +418,7 @@ You can use this to manually set buffer-local settings: - * `b:gutentags_tagfile` (see |gutentags_tagfile|). + * `b:gutentags_ctags_tagfile` (see |gutentags_ctags_tagfile|). This setting was previously called `gutentags_enabled_user_func`. The old setting is
--- a/plugin/gutentags.vim Sat Feb 18 18:20:51 2017 -0800 +++ b/plugin/gutentags.vim Sat Feb 18 18:21:35 2017 -0800 @@ -45,7 +45,6 @@ call add(g:gutentags_project_info, {'type': 'python', 'file': 'setup.py'}) call add(g:gutentags_project_info, {'type': 'ruby', 'file': 'Gemfile'}) -let g:gutentags_exclude = get(g:, 'gutentags_exclude', []) let g:gutentags_exclude_project_root = get(g:, 'gutentags_exclude_project_root', ['/usr/local']) let g:gutentags_resolve_symlinks = get(g:, 'gutentags_resolve_symlinks', 0) let g:gutentags_generate_on_new = get(g:, 'gutentags_generate_on_new', 1)