" -R : recursive
" --extra=+f : include file name as a tag
" --fields=+S : include signature (e.g. parameter list)
" K : include kind of tag as full name
" -k : not kind of tag as single letter
" --totals : print on standard output total number of tags, etc.
" --c-kinds=+p : include function prototype in C code
let ctags_command=Tlist_Ctags_Cmd.' -R --extra=+f --fields=+SK-k --totals --c-kinds=+p .'
I have 'cscopetag' set, so that pressing CTRL-] on a tag name with multiple matches will prompt me before jumping.
When I CTRL-] on a function name, I usually get 2 hits, one for the prototype, the other for the function. If both are in the same file, choosing either hit will jump to the prototype always.
Does anyone else see this issue? Am I doing something wrong?
I found a reasonable workaround for my uses. Using the -B flag to ctags generation generates backwards search patterns from the end of the file, so always the last occurrence (the function definition) is found instead of always the first (the function prototype). This makes the prototype for these functions inaccessible via tag jumping, but normally I want the function definition anyway so it's less of an issue than the behavior without -B.
> Just generating tags for
>
> prototypes using line numbers but using patterns for the rest of the
>
> tags would be a decent compromise, but I'm not sure how I'd accomplish
>
> that (if it's even possible).
>
>
I realized after some thought that this still wouldn't work, unless I also use backwards search. I may experiment sometime to see if I can generating ONLY prototype tags and append them to a tags file generated without prototypes. Then I could use forward search for prototypes and backwards search for definitions.
Forward searching prototypes and backward searching functions is actually
really easy, I found. Just invoke ctags twice, as follows:
!"C:/Documents and Settings/ben/ctags58_win32/ctags.exe" --extra=+f --fields=+SK-k --totals -B %
!"C:/Documents and Settings/ben/ctags58_win32/ctags.exe" --extra=+f --fields=+SK-k --totals --c-kinds=p -a %
Now I can access both the prototype and the function definition regardless
of how similar the location pattern!