I am experimenting with Ctags in my cmd terminal. Perhaps I should first give some background information about my system:
First I navigate to my C/C++ source folder with the cmd terminal. Then I issue the following command:
ctags -R --output-format=json -f tag.tg
I get a tag file in the current directory as expected. The tag-file refers to each tag using a pattern
. That's great, but I want to have line-numers instead. So I remove the tag file first, and rebuild it with the following command:
ctags -R --output-format=json --excmd=number -f tag.tg
But nothing changes. I still got a pattern
field where I want to have a line-number
field (not sure how that field would be named exactly, but you get the point).
What did I do wrong?
I tried the following approach:
ctags -R --output-format=json --fields="n" -f tag.tg
This gives me indeed the "line"
field. But the "typeref"
, "kind"
, "scope"
and "scopeKind"
fields are gone.
The following approach keeps all those fields:
ctags -R --output-format=json --fields="+n" -f tag.tg
Thank you Stargateur for your answer :-)
According to the documentation you need to ask specific field with --fields
option:
ctags -R --output-format=json --fields="n" -f tag.tg
Works for me.
You can see full list of option with:
ctags --list-fields