Ctags

Aus SchnallIchNet
Wechseln zu: Navigation, Suche

ctags is used to create 'tags' perhaps for a php-project.
it stores the tags in a file and that is usable for vi and its derivates, e.g. vim


examples

here are some examples:

php-project

ctags \
     -h ".php" -R \
     --exclude="\.svn" \
     --totals=yes \
     --tag-relative=yes \
     --PHP-kinds=+cf \
     --regex-PHP='/abstract class ([^ ]*)/\1/c/' \
     --regex-PHP='/interface ([^ ]*)/\1/c/' \
     --regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'

this enables you to call vim with '-t TAG' to open a secific file that contains the TAG
or to get a selection of files containing the TAG!

  1. lets say you have a function named 'checkUstID()'.
  2. change to the root-directory of your source-code - the directory
    where you called ctags and where the file 'tags' was created...
  3. start vi with '-t TAG' parameter:
    vi -t checkUstID

MAGIC!! vi will open the file containing the tag
or will present you a list of files which contain the tag and will let YOU decide which to open...

See also

Vim