Search code examples
ag

ag/the_silver_searcher How to add new custom file type?


From what I see the list of languages is hardcoded in the src/lang.c Is there a workaround to add some custom languages besides those listed in the C file?


Solution

  • Meanwhile, that's what I did:

    # 1) I uninstalled precompiled(
    apt autoremove silversearcher-ag
    
    # 2) cd /tmp && git clone https://github.com/ggreer/the_silver_searcher && cd the_silver_searcher
    
    # 3) added some missing languages to the `langs` array - https://github.com/ggreer/the_silver_searcher/blob/master/src/lang.c#L7-L146
    
    # 4)
    ./build.sh
    
    # 5)
    sudo make install
    
    # 6) Verified new types appeared in the `` output of:
    ag --list-file-types