Feature Request: Ability to filter only tags in current file

  1. Mario Grgic

    Command-T can currently filter all tags with :CommandTTag command. However, this is not that useful, since for large project ctags generated tag file can have over million entries and invoking this command brings Vim to a crawl for tens of minutes.

    What would be more useful for quick navigation by method name in current file is for Command-T to be able to filter by tags only in current file.

    It doesn't look like this would be too hard to implement. command-t/scanner/tag_scanner.rb already uses Vim's built in function taglist({expr}) to generate the list of tags to search. Instead of calling taglist("."), ctags could be invoked directly on the current file. Something like the following shell function will list methods/functions in the file specified

    methods ()
    {
        if [[ $# == 0 ]]; then
            echo "Usage: methods files";
        else
            ctags -f - --excmd=pattern --format=2 --fields=nKs --sort=yes "$@" | awk -F'\t' '/method|function/ {print $1}';
        fi
    }

    Another alternative is to user Vim's tagfiles() function to get the handle on all the tag files (relative to current dir) and extract all tags pertinent to the current file.

Reply

This topic is now closed.