-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting b:gutentags_ctags_extra_args #350
base: master
Are you sure you want to change the base?
Add setting b:gutentags_ctags_extra_args #350
Conversation
Similar to #342 but this pull request doesn't depend on an additional plugin. |
I think this feature needs an update. I got this error in a
I suppose This might fix it: diff --git a/autoload/gutentags/ctags.vim b/autoload/gutentags/ctags.vim
index 348e610..e6b417b 100644
--- a/autoload/gutentags/ctags.vim
+++ b/autoload/gutentags/ctags.vim
@@ -9,7 +9,7 @@ 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 b:gutentags_ctags_extra_args = get(b:, 'gutentags_ctags_extra_args', [])
+let s:gutentags_ctags_extra_args = get(b:, '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', [])
@@ -173,7 +173,7 @@ function! gutentags#ctags#generate(proj_dir, tags_file, gen_opts) abort
if l:use_tag_relative_opt
let l:cmd += ['-O', shellescape("--tag-relative=yes")]
endif
- for extra_arg in g:gutentags_ctags_extra_args + b:gutentags_ctags_extra_args
+ for extra_arg in g:gutentags_ctags_extra_args + s:gutentags_ctags_extra_args
let l:cmd += ['-O', shellescape(extra_arg)]
endfor
if !empty(g:gutentags_ctags_post_process_cmd) |
Hi! Thanks for this. I don't think the other PR #342 requires an additional plugin? If I understand correctly, the author just said that the change allows using another plugin they like because the tags are correctly generated for the given language. That said, that other PR manipulates the global array in a way that can cause side-effects, whereas here we just combine the two arrays as needed, which is better IMHO. I suppose the buffer-local variable is also more consistent with how other variables in gutentags have the global/local dichotomy too, so that's nice! However:
|
Oops, then I misunderstood him/her.
Nice! This works. I have pushed this change.
Then I would use this in my autocmd FileType python let b:gutentags_ctags_extra_args = ['--languages=Python', '-o'] | let b:gutentags_ctags_tagfile = "tags-" . &ft This gives me:
|
Some debug information: :echo b:gutentags_ctags_tagfile
tags-python :verbose GutentagsUpdate
gutentags: Wildignore options file is up to date.
gutentags: Running: ['/home/max/.dotfiles/vim/.vim/pack/plugins/start/vim-gutentags/plat/unix/update_tags.sh', '-e',
'ctags', '-t', 'tags-python', '-p', '.', '-o', '/home/max/.dotfiles/vim/.vim/pack/plugins/start/vim-gutentags/res/c
tags_recursive.options', '-O', '--languages=Python', '-O', '-o', '-x', '@/tmp/nvim.max/8xyujs/0', '-x', 'tags', '-x'
, 'virtual_envs', '-x', '.ccls-cache', '-x', '.mypy_cache', '-x', '*.json', '-x', '*.rst', '-x', '*.md', '-x', '*.cs
s', '-x', '*.js', '-x', '*.html', '-x', '*.diff', '-x', '*.patch', '-x', '*.svg', '-x', '*.tex', '-x', '*.pb', '-l',
'tags-python.log']
gutentags: In: /home/max/.dotfiles |
OK, my bad 🙃. I forgot to delete the let b:gutentags_ctags_extra_args = ['--languages=Python', '-o'] |
When I opened first a dae35b5 fixes this. |
The new buffer-local settings
b:gutentags_ctags_extra_args
can be used to create separate tag files for different programming languages.Example:
Updated example configuration as suggested by @ludovicchabant:
Fixes #264!?