tags — Format of the tags file

Description

When you use the vi :tag or ex :tag command, or the ex –t, more –5, vi –t, option, that utility looks for a file called tags in the current directory. This lets you quickly locate various points of interest in a C program which can span more than one source file. These points of interest are tags.

The tags file contains tags for function definitions, preprocessor macro definitions, and typedef definitions.

For each tag, the tags file contains one line in the following form:
tagname    sourcefile    address

The tagname field is the name of the C function, macro, or typedef. The sourcefile field has the name of the source file containing the tag named tagname. The address field is an editor address within sourcefile to reach the tag definition. This is either a line number in the file or a regular expression (enclosed in ? or / characters) that uniquely matches the line of source code where the tag appears. A tab character separates each field.

For vi or more to use the tags file correctly, it must be sorted by tagname using the POSIX locale's collation sequence.

Related information

The more, sort, and vi commands.