ctags

Generate tags files (POSIX)

Syntax:

ctags options files...

Options:

-a
Append to the tags file, instead of overwriting it.
-B
Use ? regexp ? instead of / regexp /.
-D word
Ignore word. This is handy for parameter macro names.
-e
Include extern tags.
-F
Use / regexp / (the default).
-h
Add hints to help elvis distinguish between overloaded tags.
-i
Include inline definitions.
-l
("el") Add a ln line number hint (implies -h).
-N
Use line numbers instead of / regexp /.
-p
Write parsing information to stdout (for debugging ctags).
-r
Write a refs file, in addition to tags.
-s
Include static tags.
-t
Include typedefs.
-v
Include variable declarations.
-x
Write a cross-reference table to stdout instead of to the tags file.
files
The pathnames of the files that are to be scanned for tags.

Description:

The ctags utility generates a file called tags from a group of C source files.

Each C source file is scanned for #define statements and function definitions. The name of the macro or function becomes the name of a tag. For each tag, a line is added to the tags file, which contains:

  • the name of the tag
  • a tab character
  • the name of the file containing the tag
  • a tab character
  • a way to find the particular line within the file

If you don't specify any options, ctags uses -l -i -s -t -v.

The elvis , , , and less , utilities can use entries in the tags file to locate and display a definition.

Examples:

Generate tags for all the C source and header files in the current directory:

ctags *.[ch]

Contributing author:

Steve Kirkendall; ctags is part of the elvis suite.

Last modified: 2013-12-21



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus