I have a compiled code. If i try generation the tags using the 'usr/bin/ctags -R *', it will include all the c,h,object files etc. So it is taking lot of time and also memory. Could you please let me know how to generate tags only for c/h files.
How to create ctags only for c and h files in code
Use the --languages parameter:
ctags --languages=C
--languages only can read .c file, but not .h file, it should use: ctags -h=".c.h" –
Strictly
--languages only includes .c, so you need to also include c++ "--languages=C,C++" which will add .h files as well as several c++ file extensions. ".h" files have to be processed as C++ since it is a superset and you can't assume they only use C language features –
Psittacine
You can use a .ctagsignore
file to exclude any unwanted files from the generated tags.
The following is an example I use for my projects:
Contents of .ctagsignore:
bin
makefile
obj
tags
workspace.vim
And then generate tags with:
-ctags -R [email protected]
This ignores every file in the bin, and obj folder, the makefile, the (future) generated tags file, and the workspace.vim file in the project directory. It essentially works like a .gitignore file, so you can use the wildcard (*.o) notation - myfolder/*.o ignores all object files in $PROJ_DIR$/myfolder/
i would try 'man ctags' and read thru the options.
or you can use shell magic like:
ctags `find . -name "*.[ch]" -print`
or something like that
I feel this is the best option. –
Nyberg
© 2022 - 2024 — McMap. All rights reserved.