How to add comments to an Exuberant Ctags config file?

后端 未结 4 1980
梦如初夏
梦如初夏 2021-02-03 21:44

What character can I use to put comments in an Exuberant Ctags .ctags file?

I would like to add comments with explanations, and perhaps to disable some rege

4条回答
  •  我寻月下人不归
    2021-02-03 22:14

    Given that comments don't work, what about a .ctags.readme file...

    For most things you don't actually need a comment, e.g. you don't really need the comment below.

    # Define tags for the Coffeescript language
    --langdef=coffee
    --langmap=coffee:.coffee
    

    I can see however that you might want to add comments explaining some mind bending regex, so for each line that absolutely needs it you can copy paste it into the .ctags.readme file as a markdown file:

    Forgive me father for I have regexed
    It was purely because I wanted some lovely coffee properties
    ```
    --regex-coffee=/^[ \t]*@?([a-zA-Z_$][0-9a-zA-Z_$]*):.*$/\1/p,property/
    ```
    

    Keeping .ctags.readme and .ctags in sync

    You could have a block at the bottom of the ctags file separated with a line break, then delete this final block.

    If you only have the one line break in your .ctags file this sed will delete all the lines after the line break.

    Then do some grepping for the --regex lines to append the lines from .ctags.readme into .ctags.

    sed -i '/^\s*$/,$d' .ctags
    grep "^--regex" .ctags.readme >> .ctags
    

提交回复
热议问题