Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim and Ctags: Ignoring certain files while generating tags

Tags:

vim

ctags

I have a folder llvm2.9 in which i ran this command.

$> ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ 

This was indexing methods in *.html files also which were present in llvm2.9/docs. I found this out because when i pressed ctrl-] for some class, it went to the html file.

How do i force ctags to use .cpp/.h files alone or ignore a particular directory.

Thanks

like image 649
excray Avatar asked Oct 12 '11 07:10

excray


2 Answers

You can exclude a filetype using --exclude='*.html'

like image 145
skeept Avatar answered Oct 12 '22 11:10

skeept


If you need to exclude more than just .html files:

You can't comma separate a list inside an exclude option. This doesn't work:

ctags --exclude=*.html,*.js ./* 

However, you can pass multiple exclude options:

ctags --exclude=*.html --exclude=*.js ./* 

Pass the -V option to help with debugging:

ctags -V --exclude=*.html --exclude=*.js ./* 

Gives the output:

Reading initial options from command line   Option: --exclude=*.html     adding exclude pattern: *.html   Option: --exclude=*.js     adding exclude pattern: *.js 
like image 28
eupharis Avatar answered Oct 12 '22 11:10

eupharis