I am trying to create a tag file manually for C sources (*.c and *.h) using ctags command. Unfortunately the tag file is not having entries of all files, specially the header files.
I am using following command on the command prompt:
find . -name \*.[ch] -exec ctags {} \;
Kindly point out if I am missing some flag or something else above.
If you execute (your version):
find . -name \*.[ch] -exec ctags {} \;
then find executes ctags once for each file that is found. The tags file is overwritten each time, and only the tags for the last file remain.
Instead, you need to tell find to execute ctags exactly once, and specify all the matching files in one call. This is how you do that:
find . -name \*.[ch] -exec ctags {} +
OR (I like trojanfoe's version from the comment below because it is easier to read):
ctags $(find . -name \*.[ch])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With