Search code examples
c++ctagsexuberant-ctags

How to Modify default separator for CTAGS generated tag file


The default separator is tab character which is \t. However, if there are comments in a line of code being analyzed it messes up the format of the generated tag file. How to Modify default separator for CTAGS generated tag file?


Solution

  • You may like xformat feature of Universal-ctags. With the feature you can define your own format of output.

    [jet@localhost]~/var/ctags% cat input.c
    
    #define ZERO 0
    int main(void)
    {
        return ZERO;
    }
    [jet@localhost]~/var/ctags% ./ctags -x --_xformat='(N, K, L) = ("%{name}", "%{kind}", %{line})' input.c
    
    (N, K, L) = ("ZERO", "macro", 1)
    (N, K, L) = ("main", "function", 2)
    

    http://docs.ctags.io/en/latest/news.html#customizing-xref-output may give you more hints.