vim-gutentags icon indicating copy to clipboard operation
vim-gutentags copied to clipboard

no tags file found after reloading config file

Open nqiu opened this issue 6 years ago • 3 comments

I'm using vim-gutentags with spf13-vim. My configuration is as follows,

" in ~/.vimrc.bundles.local
Bundle 'ludovicchabant/vim-gutentags'
Bundle 'skywind3000/gutentags_plus' 
" in ~/.vimrc.local
let g:gutentags_modules = ['ctags', 'gtags_cscope']
let g:gutentags_project_root = ['.root', '.git', '.project']
let g:gutentags_cache_dir = expand('~/.cache/tags') 
let g:gutentags_plus_switch = 1 
let g:gutentags_ctags_extra_args = ['-I __THROW', '-I __attribute_pure__', '-I __nonull', '-I __attr#
let g:gutentags_ctags_extra_args += ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']                                                
let g:gutentags_ctags_extra_args += ['/usr/include', '/usr/local/include']

Everything works well and tags file works. But after I ran :source ~/.vimrc, :echo tagfiles returned an empty list. It seems that this <file_name>.c file has been "marked". Vim complained "No tags file found" even I reopen this file. But other C files work well with tags.

I try to read the source of this plugin, but cannot figure out why this happens, Could you help?

nqiu avatar Sep 24 '19 13:09 nqiu

But after I ran :source ~/.vimrc, :echo tagfiles returned an empty list.

Can you run :echo &tags? That will show you what tags file Gutentags added to the list... if tagsfiles() returns an empty list, it's probable that the file was not created, so Vim ignores it. You can do let g:gutentags_trace = 1 to troubleshoot why the tags file wasn't created.

It seems that this <file_name>.c file has been "marked"

What do you mean?

ludovicchabant avatar Oct 26 '19 08:10 ludovicchabant

Vim-gutentags worked well util I deleted ~/.vimswap/adlist.c.swap file(I'm reading redis source code using vim). After removing ~/.vimswap/adlist.c.swap file, vim couldn't load the tag file. I'm sure the tag file was created in ~/.cache/tags/ dir, and it can be loaded in all other source files except in the adlist.c file.

in adlist.c file, echo &tags shows an empty list, but in all other source files, echo &tags shows ['/root/.cache/tags/root-Workspace-redis-tags']

after setting let g:gutentags_trace = 1, :messages seems no warnings and errors, as follows,

gutentags: Scanning buffer 'adlist.c' for gutentags setup... gutentags: No specific project type. gutentags: Setting gutentags for buffer 'adlist.h' gutentags: Generating tags file: /root/.cache/tags/root-Workspace-redis-tags gutentags: Wildignore options file is up to date. gutentags: Running: ['/root/.vim/bundle/vim-gutentags/plat/unix/update_tags.sh', '-e', 'ctags', '-t', '/root/.cache/tags/root-Workspace-redis-tags', '-p', '/r oot/Workspace/redis', '-o', '/root/.vim/bundle/vim-gutentags/res/ctags_recursive.options', '-l', '/root/.cache/tags/root-Workspace-redis-tags.log'] gutentags: In: /root/Workspace/redis gutentags: Generating tags file: /root/.cache/tags/root-Workspace-redis/GTAGS gutentags: Running: ['gtags', '--incremental', '/root/.cache/tags/root-Workspace-redis'] gutentags: In: /root/Workspace/redis gutentags: gutentags: [job stdout]: 'Locking tags file...' gutentags: [job stdout]: 'Running ctags on whole project' gutentags: [job stdout]: 'ctags -f "/root/.cache/tags/root-Workspace-redis-tags.temp" --options=/root/.vim/bundle/vim-gutentags/res/ctags_recursive.options " /root/Workspace/redis"' Press ENTER or type command to continue gutentags: Finished gtags_cscope job. gutentags: [job stdout]: 'Replacing tags file' gutentags: [job stdout]: 'mv -f "/root/.cache/tags/root-Workspace-redis-tags.temp" "/root/.cache/tags/root-Workspace-redis-tags"' gutentags: [job stdout]: 'Unlocking tags file...' gutentags: [job stdout]: 'Done.' gutentags: Finished ctags job.

nqiu avatar Dec 11 '19 17:12 nqiu

I can't see what would make this adlist.c file any different from the other ones. I grabbed the redis source and it's all working fine for me. I also have no idea how the swap file comes into play here... sorry.

ludovicchabant avatar Feb 05 '20 07:02 ludovicchabant