Reputation: 347
I would like to automatically load all (c)tag file from a specific directory on startup of VIM. Currently I add them by hand:
set tags+=~/.tags/tag1
set tags+=~/.tags/tag2
set tags+=~/.tags/tag3
I would like to load all files via a wildcard and I tried something like this:
set tags+=~/.tags/*
which unfortunately doesn't work. Any ideas how I get this to work?
Best wishes, Peter
Upvotes: 1
Views: 1295
Reputation: 39
You can try (in .vimrc):
for tagfile in split(globpath('$PWD/.tags/', '*'), '\n')
let &tags .=',' . tagfile
endfor
I use $PWD
because I always generate my tag files from the top of the project (and placed in .tags
dir) and launch vim from the top (so $PWD
works in my case) - but you can substitute for any hardcoded directory.
Upvotes: 0
Reputation: 1
You can specify multiple tag files in your .vimrc in the following manner by separating the list of tags files with a space, but you need to backslash your space.
example follows with 2. I do this to bring in tag files from my libraries.
set tags=./TAGS\ /path/to/your/other/TAGS
While in vi, you can type the following while in command mode;
:set tags=./TAGS\ /path/to/your/other/TAGS
Upvotes: 0
Reputation: 32986
You'll have to play with glob()
I guess.
Something like (untested):
exe 'set tags+='.substitute(glob('~/.tags'), "\n", ',', 'g')
Upvotes: 2