I am working with some code which has the following style:
int
add5 (int x) {
return x+5;
}
In other words, the return value type of the function is written right above the function's name. Because of that, ctags
is not recognizing these functions and causing me a terrible headache. Does someone know how to get ctags
to handle this case?
EDIT: ctags
can recognize the function names on .c files but what I need is ctags
to recognize the function names on .h
files. On the .h files I have things such as:
int
add5 (int);
and there ctags
does not recognize add5
.
You have to tell ctags
to search for prototypes of functions. It is done with --<LANG>-kinds
option.
So, run following command:
ctags --c-kinds=+p *
And it will add the declaration to the tags
file, as you can see in the output of my test:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
add5 add.h /^add5 (int);$/;" p