.\" Man page generated from reStructuredText. . .TH CTAGS-UNIVERSAL 1 "" "0.0.0" "Universal-ctags" .SH NAME ctags-universal \- Generate tag files for source code . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .nf \fBctags\-universal\fP [options] [source_file(s)] \fBetags\fP [options] [source_file(s)] .fi .sp .SH DESCRIPTION .sp The \fBctags\-universal\fP and \fBetags\fP programs (hereinafter collectively referred to as ctags\-universal, except where distinguished) generate an index (or "tag") file for a variety of \fBlanguage objects\fP found in \fBsource file(s)\fP\&. This tag file allows these items to be quickly and easily located by a text editor or other utilities (\fBclient tools\fP). A \fBtag\fP signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object). .sp Alternatively, ctags\-universal can generate a cross reference file which lists, in human readable form, information about the various language objects found in a set of source files. .sp Tag index files are supported by numerous editors, which allow the user to locate the object associated with a name appearing in a source file and jump to the file and line which defines the name. See the manual of your favorite editor about utilizing ctags\-universal command and the tag index files in the editor. .sp ctags\-universal is capable of generating different \fBkinds\fP of tags for each of many different \fBlanguages\fP\&. For a complete list of supported languages, the names by which they are recognized, and the kinds of tags which are generated for each, see the \fB\-\-list\-languages\fP and \fB\-\-list\-kinds\-full\fP options. .sp This man page describes \fBUniversal\-ctags\fP, an implementation of ctags derived from \fBExuberant\-ctags\fP\&. The major incompatible changes between Universal\-ctags and Exuberant\-ctags are enumerated in ctags\-incompatibilities(7). .sp One of the advantages of Exuberant\-ctags is that it allows a user to define a new parser from the command line. Extending this capability is one of the major features of Universal\-ctags. ctags\-optlib(7) describes how the capability is extended. .sp Newly introduced experimental features are not explained here. If you are interested in such features and ctags\-universal internals, visit \fI\%http://docs.ctags.io/en/latest/\fP\&. .SH SOURCE FILES .\" Q: it's strange to have a MAN page put this section here so early in the .\" man page, instead of having the "OPTION ITEMS" section be right after .\" the Description section, no? I mean the man page for most programs starts .\" with a very brief description of the program, then all the command-line .\" options, then later detailed backgound and descriptions like this section. . .sp Unless the \fB\-\-language\-force\fP option is specified, the language of each source file is automatically selected based upon a \fBmapping\fP of file names to languages. The mappings in effect for each language may be displayed using the \fB\-\-list\-maps\fP option and may be changed using the \fB\-\-langmap\fP or \fB\-\-map\-\fP options. .sp If the name of a file is not mapped to a language, ctags\-universal tries to heuristically guess the language for the file by inspecting its content. See "Determining file language". .sp All files that have no file name mapping and no guessed parser are ignored. This permits running ctags\-universal on all files in either a single directory (e.g. "ctags\-universal *"), or on all files in an entire source directory tree (e.g. "ctags\-universal \-R"), since only those files whose names are mapped to languages will be scanned. .sp The same extensions are mapped to multiple parsers. For example, ".h" are mapped to C++, C and ObjectiveC. These mappings can cause issues. ctags\-universal tries to select the proper parser for the source file by applying heuristics to its content, however it is not perfect. In case of issues one can use \fB\-\-language\-force=language\fP, \fB\-\-langmap=map[,map[...]]\fP, or the \fB\-\-map\-=\-pattern|extension\fP options. (Some of the heuristics are applied whether \fB\-\-guess\-language\-eagerly\fP is given or not.) .\" options should be revised here .\" ``--map-`` (done) .\" ``--langmap=map[,map[...]]`` (done) .\" ``--language-force=language`` (done) .\" ``--languages=[+|-]list`` (done) .\" ``--list-maps[=language|all]`` (done) .\" ``--list-map-extensions`` (done) .\" ``--list-map-patterns`` (done) . .SS Determining file language .sp If ctags\-universal cannot select a parser from the mapping of file names, various heuristic tests are conducted to determine the language: .INDENT 0.0 .TP .B template file name testing If the file name has an ".in" extension, ctags\-universal applies the mapping to the file name without the extension. For example, "config.h" is tested for a file named "config.h.in". .TP .B "interpreter" testing The first line of the file is checked to see if the file is a "#!" script for a recognized language. ctags\-universal looks for a parser having the same name. .sp If ctags\-universal finds no such parser, ctags\-universal looks for the name in alias lists. For example, consider if the first line is "#!/bin/sh". Though ctags\-universal has a "shell" parser, it doesn\(aqt have a "sh" parser. However, "sh" is listed as an alias for "shell", therefore ctags\-universal selects the "shell" parser for the file. .sp An exception is "env". If "env" is specified, ctags\-universal reads more lines to find real interpreter specification. .sp To display the list of aliases, use \fB\-\-list\-aliases\fP option. To add/remove an item to/from the list, use the \fB\-\-alias\-=[+|\-]aliasPattern\fP option. .TP .B "zsh autoload tag" testing If the first line starts with "#compdef" or "#autoload", ctags\-universal regards the line as "zsh". .TP .B "emacs mode at the first line" testing The Emacs editor has multiple editing modes specialized for programming languages. Emacs can recognize a marker called modeline in a file and utilize the marker for the mode selection. This heuristic test does the same as what Emacs does. .sp ctags\-universal treats \fIMODE\fP as a name of interpreter and applies the same rule of "interpreter" testing if the first line has one of the following patterns: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C \-*\- mode: MODE \-*\- .ft P .fi .UNINDENT .UNINDENT .sp or .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C \-*\- MODE \-*\- .ft P .fi .UNINDENT .UNINDENT .TP .B "emacs mode at the EOF" testing Emacs editor recognizes another marker at the end of file as a mode specifier. This heuristic test does the same as what Emacs does. .sp ctags\-universal treats \fIMODE\fP as a name of an interpreter and applies the same rule of "interpreter" heuristic testing, if the lines at the tail of the file have the following pattern: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C Local Variables: \&... mode: MODE \&... End: .ft P .fi .UNINDENT .UNINDENT .sp 3000 characters are sought from the end of file to find the pattern. .TP .B "vim modeline" testing Like the modeline of the Emacs editor, Vim editor has the same concept. ctags\-universal treats \fITYPE\fP as a name of interpreter and applies the same rule of "interpreter" heuristic testing if the last 5 lines of the file have one of the following patterns: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C filetype=TYPE .ft P .fi .UNINDENT .UNINDENT .sp or .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C ft=TYPE .ft P .fi .UNINDENT .UNINDENT .TP .B "PHP marker" testing If the first line is started with "\fP option. .SS Extras .sp Generally, ctags\-universal tags only language objects appearing in source files, as is. In other words, a value for a \fBname:\fP field should be found on the source file associated with the \fBname:\fP\&. An "extra" type tag (\fIextra\fP) is for tagging a language object with a processed name, or for tagging something not associated with a language object. A typical extra tag is "qualified", which tags a language object with a class\-qualified or scope\-qualified name. .sp The following example demonstrates the "qualified" extra tag. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C package Bar; import Baz; class Foo { // ... } .ft P .fi .UNINDENT .UNINDENT .sp For the above source file, ctags\-universal tags "Bar" and "Foo" by default. If the "qualified" extra is enabled from the command line (\fB\-\-extras=+q\fP), then "Bar.Foo" is also tagged even though the string "Bar.Foo" is not in the source code. .sp See also the descriptions of \fB\-\-list\-extras\fP option and \fB\-\-extras\fP option in "OPTION ITEMS". .SS Roles .sp \fIRole\fP is a newly introduced concept in Universal\-ctags. Role is a concept associated with reference tags, and is not implemented widely yet. .sp As described previously in "Kinds", the "kind" field represents the type of language object specified with a tag, such as a function vs. a variable. Specific kinds are defined for reference tags, such as the C++ kind "header" for header file, or Java kind "package" for package statements. For such reference kinds, a "roles" field can be added to distinguish the role of the reference kind. In other words, the "kind" field identifies the "what" of the language object, whereas the "roles" field identifies the "how" of a referenced language object. Roles are only used with specific kinds. .sp For example, for the source file used for demonstrating in the "Extras" subsection, "Baz" is tagged as a reference tag with kind "package" and with role "imported". Another example is for a C++ "header" kind tag, generated by "#include" statements: the \fBroles:system\fP or \fBroles:local\fP fields will be added depending on whether the include file name begins with "<" or not. .sp See also the descriptions of \fB\-\-list\-roles\fP option. .SS Language\-specific fields and extras .sp Exuberant\-ctags has the concept of "fields" and "extras". They are common between parsers of different languages. Universal\-ctags extends this concept by providing language\-specific fields and extras. .\" options should be explained and revised here .\" ``--list-languages`` (done) .\" ``--list-kinds`` (done) .\" ``--list-kinds-full``(done) .\" ``--list-fields`` (done) .\" ``--list-extras`` (done) .\" ``--list-roles`` (done) .\" ``--kinds-=`` (done) .\" ``--fields=`` (done) .\" ``--fields-`` (done) .\" ``--extras=`` (done) .\" ``--extras-=`` (done) . .SH COMMAND LINE INTERFACE .sp Despite the wealth of available options, defaults are set so that ctags\-universal is most commonly executed without any options (e.g. "ctags\-universal *", or "ctags\-universal \-R"), which will create a tag file in the current directory for all recognized source files. The options described below are provided merely to allow custom tailoring to meet special needs. .sp Note that spaces separating the single\-letter options from their parameters are optional. .sp Note also that the boolean parameters to the long form options (those beginning with "\-\-" and that take a "[=yes|no]" parameter) may be omitted, in which case "=yes" is implied. (e.g. \fB\-\-sort\fP is equivalent to \fB\-\-sort=yes\fP). Note further that "=1", "=on", and "=true" are considered synonyms for "=yes", and that "=0", "=off", and "=false" are considered synonyms for "=no". .sp Some options are either ignored or useful only when used while running in etags mode (see \-e option). Such options will be noted. .sp Most options may appear anywhere on the command line, affecting only those files which follow the option. A few options, however, must appear before the first file name and will be noted as such. .sp Options taking language names will accept those names in either upper or lower case. See the \fB\-\-list\-languages\fP option for a complete list of the built\-in language names. .SS Letters and names .sp Some options take letters as parameters (e.g. \fB\-\-kinds\-\fP option). Specifying just letters help a user create a complicated command line quickly. However, a command line including sequences of single letters becomes difficult to understand. .sp Universal\-ctags accepts names in addition to such letters. The names and letters can be mixed in an option parameter by surrounding each name by braces. Thus, for an example, the following three notations for \fB\-\-kinds\-C\fP option have the same meaning: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C \-\-kinds\-C=+pLl \-\-kinds\-C=+{prototype}{label}{local} \-\-kinds\-C=+{prototype}L{local} .ft P .fi .UNINDENT .UNINDENT .sp Note that braces may be meta characters in your shell. Put single quotes in such case. .sp \fB\-\-list\-...\fP options shows letters and associated names. .SS List options .sp Universal\-ctags introduces many \fB\-\-list\-...\fP options that provide the internal data of Universal\-ctags. Both users and client tools may use the data. \fB\-\-with\-list\-header\fP and \fB\-\-machinable\fP options adjust the output of the most of \fB\-\-list\-...\fP options. .sp The default setting (\fB\-\-with\-list\-header=yes\fP and \fB\-\-machinable=no\fP) is for using interactively from a terminal. The header that explains the meaning of columns is simply added to the output, and each column is aligned in all lines. The header line starts with a hash (\(aq#\(aq) character. .sp For scripting in a client tool, \fB\-\-with\-list\-header=no\fP and \fB\-\-machinable=yes\fP may be useful. The header is not added to the output, and each column is separated by tab characters. .sp Note the order of columns will change in the future release. However, labels in the header will not change. So by scanning the header, a client tool can find the index for the target column. .\" options that should be explained and revised here .\" ``--list-features`` (done) .\" ``--machinable`` (done) .\" ``--with-list-header`` (done) . .SH OPTION ITEMS .sp ctags\-universal has more options than listed here. Options starting with an underscore character, such as \fB\-\-_echo=msg\fP, are not listed here. They are experimental or for debugging purpose. .INDENT 0.0 .TP .B \fB\-a\fP Equivalent to \fB\-\-append\fP\&. .TP .B \fB\-B\fP Use backward searching patterns (e.g. ?pattern?). [Ignored in etags mode] .TP .B \fB\-e\fP Same as \fB\-\-output\-format=etags\fP\&. Enable etags mode, which will create a tag file for use with the Emacs editor. Alternatively, if ctags\-universal is invoked by a name containing the string "etags" (either by renaming, or creating a link to, the executable), etags mode will be enabled. This option must appear before the first file name. .TP .B \fB\-f tagfile\fP Use the name specified by tagfile for the tag file (default is "tags", or "TAGS" when running in etags mode). If tagfile is specified as "\-", then the tags are written to standard output instead. ctags\-universal will stubbornly refuse to take orders if tagfile exists and its first line contains something other than a valid tags line. This will save your neck if you mistakenly type "ctags\-universal \-f *.c", which would otherwise overwrite your first C file with the tags generated by the rest! It will also refuse to accept a multi\-character file name which begins with a \(aq\-\(aq (dash) character, since this most likely means that you left out the tag file name and this option tried to grab the next option as the file name. If you really want to name your output tag file "\-ugly", specify it as "./\-ugly". This option must appear before the first file name. If this option is specified more than once, only the last will apply. .TP .B \fB\-F\fP Use forward searching patterns (e.g. /pattern/) (default). [Ignored in etags mode] .TP .B \fB\-G\fP Equivalent to \fB\-\-guess\-language\-eagerly\fP\&. .TP .B \fB\-h list\fP Specifies a list of file extensions, separated by periods, which are to be interpreted as include (or header) files. To indicate files having no extension, use a period not followed by a non\-period character (e.g. ".", "..x", ".x."). This option only affects how the scoping of particular kinds of tags are interpreted (i.e. whether or not they are considered as globally visible or visible only within the file in which they are defined); it does not map the extension to any particular language. Any tag which is located in a non\-include file and cannot be seen (e.g. linked to) from another file is considered to have file\-limited (e.g. static) scope. No kind of tag appearing in an include file will be considered to have file\-limited scope. If the first character in the list is a plus sign, then the extensions in the list will be appended to the current list; otherwise, the list will replace the current list. See, also, the \fB\-\-file\-scope\fP option. The default list is ".h.H.hh.hpp.hxx.h++.inc.def". To restore the default list, specify \fB\-h\fP default. Note that if an extension supplied to this option is not already mapped to a particular language (see "SOURCE FILES", above), you will also need to use either the \fB\-\-langmap\fP or \fB\-\-language\-force\fP option. .TP .B \fB\-I identifier\-list\fP Specifies a list of identifiers which are to be specially handled while parsing C and C++ source files. This option is specifically provided to handle special cases arising through the use of preprocessor macros. When the identifiers listed are simple identifiers, these identifiers will be ignored during parsing of the source files. If an identifier is suffixed with a \(aq+\(aq character, ctags\-universal will also ignore any parenthesis\-enclosed argument list which may immediately follow the identifier in the source files. If two identifiers are separated with the \(aq=\(aq character, the first identifiers is replaced by the second identifiers for parsing purposes. The list of identifiers may be supplied directly on the command line or read in from a separate file. If the first character of identifier\-list is \(aq@\(aq, \(aq.\(aq or a pathname separator (\(aq/\(aq or \(aq\(aq), or the first two characters specify a drive letter (e.g. "C:"), the parameter identifier\-list will be interpreted as a filename from which to read a list of identifiers, one per input line. Otherwise, identifier\-list is a list of identifiers (or identifier pairs) to be specially handled, each delimited by either a comma or by white space (in which case the list should be quoted to keep the entire list as one command line argument). Multiple \fB\-I\fP options may be supplied. To clear the list of ignore identifiers, supply a single dash ("\-") for identifier\-list. .sp This feature is useful when preprocessor macros are used in such a way that they cause syntactic confusion due to their presence. Indeed, this is the best way of working around a number of problems caused by the presence of syntax\-busting macros in source files (see "CAVEATS"). Some examples will illustrate this point. .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C int foo ARGDECL4(void *, ptr, long int, nbytes) .ft P .fi .UNINDENT .UNINDENT .sp In the above example, the macro "ARGDECL4" would be mistakenly interpreted to be the name of the function instead of the correct name of "foo". Specifying "\-I ARGDECL4" results in the correct behavior. .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C /* creates an RCS version string in module */ MODULE_VERSION("$Revision$") .ft P .fi .UNINDENT .UNINDENT .sp In the above example the macro invocation looks too much like a function definition because it is not followed by a semicolon (indeed, it could even be followed by a global variable definition that would look much like a K&R style function parameter declaration). In fact, this seeming function definition could possibly even cause the rest of the file to be skipped over while trying to complete the definition. Specifying "\-I MODULE_VERSION+" would avoid such a problem. .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C CLASS Example { // your content here }; .ft P .fi .UNINDENT .UNINDENT .sp The example above uses "CLASS" as a preprocessor macro which expands to something different for each platform. For instance CLASS may be defined as "class __declspec(dllexport)" on Win32 platforms and simply "class" on UNIX. Normally, the absence of the C++ keyword "class" would cause the source file to be incorrectly parsed. Correct behavior can be restored by specifying "\-I CLASS=class". .TP .B \fB\-L file\fP Read from file a list of file names for which tags should be generated. If file is specified as "\-", then file names are read from standard input. File names read using this option are processed following file names appearing on the command line. Options are also accepted in this input. If this option is specified more than once, only the last will apply. Note: file is read in line\-oriented mode, where a new line is the only delimiter and non\-trailing white space is considered significant, in order that file names containing spaces may be supplied (however, trailing white space is stripped from lines); this can affect how options are parsed if included in the input. .TP .B \fB\-n\fP Equivalent to \fB\-\-excmd=number\fP\&. .TP .B \fB\-N\fP Equivalent to \fB\-\-excmd=pattern\fP\&. .TP .B \fB\-o tagfile\fP Equivalent to \fB\-f tagfile\fP\&. .TP .B \fB\-R\fP Equivalent to \fB\-\-recurse\fP\&. .TP .B \fB\-u\fP Equivalent to \fB\-\-sort=no\fP (i.e. "unsorted"). .TP .B \fB\-V\fP Equivalent to \fB\-\-verbose\fP\&. .TP .B \fB\-w\fP This option is silently ignored for backward\-compatibility with the ctags of SVR4 Unix. .TP .B \fB\-x\fP Print a tabular, human\-readable cross reference (xref) file to standard output instead of generating a tag file. The information contained in the output includes: the tag name; the kind of tag; the line number, file name, and source line (with extra white space condensed) of the file which defines the tag. No tag file is written and all options affecting tag file output will be ignored. Example applications for this feature are generating a listing of all functions located in a source file (e.g. "ctags\-universal \-x \-\-c\-kinds=f file"), or generating a list of all externally visible global variables located in a source file (e.g. "ctags\-universal \-x \-\-c\-kinds=v \-\-file\-scope=no file"). This option must appear before the first file name. .TP .B \fB\-\-alias\-=[+|\-]aliasPattern\fP Adds (\(aq+\(aq) or removes (\(aq\-\(aq) an alias pattern to a language specified with \fI\fP\&. ctags\-universal refers to the alias pattern in "Determining file language" stage. .sp The parameter aliasPattern is not a list. Use this option multiple times in a command line to add or remove multiple alias patterns. .sp To restore the default language aliases, specify "default" as the parameter aliasPattern. Using "all" for \fI\fP has meaning in following two cases: .INDENT 7.0 .TP .B "\-\-alias\-all=" This clears aliases setting of all languages. .TP .B "\-\-alias\-all=default" This restores the default languages aliases for all languages. .UNINDENT .TP .B \fB\-\-append[=yes|no]\fP Indicates whether tags generated from the specified files should be appended to those already present in the tag file or should replace them. This option is "no" by default. This option must appear before the first file name. .TP .B \fB\-\-etags\-include=file\fP Include a reference to file in the tag file. This option may be specified as many times as desired. This supports Emacs\(aq capability to use a tag file which "includes" other tag files. [Available only in etags mode] .TP .B \fB\-\-exclude=[pattern]\fP Add pattern to a list of excluded files and directories. This option may be specified as many times as desired. For each file name considered by ctags\-universal, each pattern specified using this option will be compared against both the complete path (e.g. some/path/base.ext) and the base name (e.g. base.ext) of the file, thus allowing patterns which match a given file name irrespective of its path, or match only a specific path. If appropriate support is available from the runtime library of your C compiler, then pattern may contain the usual shell wildcards (not regular expressions) common on Unix (be sure to quote the option parameter to protect the wildcards from being expanded by the shell before being passed to ctags\-universal; also be aware that wildcards can match the slash character, \(aq/\(aq). You can determine if shell wildcards are available on your platform by examining the output of the \fB\-\-list\-features\fP option, which will include "wildcards" in the compiled feature list; otherwise, pattern is matched against file names using a simple textual comparison. .sp If pattern begins with the character \(aq@\(aq, then the rest of the string is interpreted as a file name from which to read exclusion patterns, one per line. If pattern is empty, the list of excluded patterns is cleared. .sp Note that at program startup, the default exclude list contains names of common hidden and system files, patterns for binary files, and directories for which it is generally not desirable to descend while processing the \fB\-\-recurse\fP option. To see the list of built\-in exclude patterns, use \fB\-\-list\-excludes\fP\&. .TP .B \fB\-\-excmd=type\fP Determines the type of EX command used to locate tags in the source file. [Ignored in etags mode] .sp The valid values for type (either the entire word or the first letter is accepted) are: .INDENT 7.0 .TP .B number Use only line numbers in the tag file for locating tags. This has four advantages: .INDENT 7.0 .IP 1. 3 Significantly reduces the size of the resulting tag file. .IP 2. 3 Eliminates failures to find tags because the line defining the tag has changed, causing the pattern match to fail (note that some editors, such as vim, are able to recover in many such instances). .IP 3. 3 Eliminates finding identical matching, but incorrect, source lines (see "BUGS"). .IP 4. 3 Retains separate entries in the tag file for lines which are identical in content. In pattern mode, duplicate entries are dropped because the search patterns they generate are identical, making the duplicate entries useless. .UNINDENT .sp However, this option has one significant drawback: changes to the source files can cause the line numbers recorded in the tag file to no longer correspond to the lines in the source file, causing jumps to some tags to miss the target definition by one or more lines. Basically, this option is best used when the source code to which it is applied is not subject to change. Selecting this option type causes the following options to be ignored: \fB\-BF\fP\&. .TP .B pattern Use only search patterns for all tags, rather than the line numbers usually used for macro definitions. This has the advantage of not referencing obsolete line numbers when lines have been added or removed since the tag file was generated. .TP .B mixed In this mode, patterns are generally used with a few exceptions. For C, line numbers are used for macro definition tags. This was the default format generated by the original ctags and is, therefore, retained as the default for this option. For Fortran, line numbers are used for common blocks because their corresponding source lines are generally identical, making pattern searches useless for finding all matches. .UNINDENT .TP .B \fB\-\-extra=[+|\-]flags|*\fP Equivalent to \fB\-\-extras=[+|\-]flags|*\fP, which was introduced to make the option naming convention align to the other options like \fB\-\-kinds\-=\fP and \fB\-\-fields=\fP\&. .sp This option is kept for backward\-compatibility with Exuberant\-ctags. .TP .B \fB\-\-extras=[+|\-]flags|*\fP Specifies whether to include extra tag entries for certain kinds of information. See also "Extras" subsection to know what are kinds. .sp The parameter flags is a set of one\-letter flags, each representing one kind of extra tag entry to include in the tag file. If flags is preceded by either the \(aq+\(aq or \(aq\-\(aq character, the effect of each flag is added to, or removed from, those currently enabled; otherwise the flags replace any current settings. All entries are included if \(aq*\(aq is given. .sp This \fB\-\-extras=\fP option is for controlling extras common in all languages (or language\-independent extras). Universal\-ctags also supports language\-specific extras. (See "Language\-specific fields and extras" about the concept). Use \fB\-\-extras\-=\fP option for controlling them. .sp The meaning of major extras is as follows (one\-letter flag/name): .INDENT 7.0 .TP .B F/fileScope Equivalent to \fB\-\-file\-scope\fP\&. .TP .B f/inputFile Include an entry for the base file name of every source file (e.g. "example.c"), which addresses the first line of the file. If the \fBend:\fP field is enabled, the end line number of the file can be attached to the tag. .TP .B p/pseudo Include pseudo tags. Enabled by default unless the tag file is written to standard output. .TP .B q/qualified Include an extra class\-qualified or namespace\-qualified tag entry for each tag which is a member of a class or a namespace. .sp This may allow easier location of a specific tags when multiple occurrences of a tag name occur in the tag file. Note, however, that this could potentially more than double the size of the tag file. .sp The actual form of the qualified tag depends upon the language from which the tag was derived (using a form that is most natural for how qualified calls are specified in the language). For C++ and Perl, it is in the form "class::member"; for Eiffel and Java, it is in the form "class.member". .sp Note: Using backslash characters as separators forming qualified name in PHP. However, in tags output of Universal\-ctags, a backslash character in a name is escaped with a backslash character. .\" TODO: Write about the detail of escaping in somewhere. . .TP .B r/reference Include reference tags. See "TAG ENTRIES" about reference tags. .UNINDENT .sp Inquire the output of \fB\-\-list\-extras\fP option for the other minor extras. .sp A name associated with an extra can be used as alternative to a one\-letter flag. Some minor extras have no one\-letters flag. In that case, names must be specified anyway. See "Letters and names" for more details. .TP .B \fB\-\-extras\-=[+|\-]flags|*\fP Specifies whether to include extra tag entries for certain kinds of information for language . Universal\-ctags introduces language\-specific extras. (See "Language\-specific fields and extras" about the concept). This option is for controlling them. .sp Specifies "all" as to apply the parameter flags to all languages; all extras are enabled with specifying \(aq*\(aq as the parameter flags. If specifying nothing as the parameter flags ("\-\-extras\-all="), all extras are disabled. These two combinations are useful for testing. .sp Check the output of the \fB\-\-list\-extras=\fP option for the extras of specific language . .TP .B \fB\-\-fields\-=[+|\-]flags|*\fP Specifies which language\-specific fields are to be included in the entries of the tag file. Universal\-ctags supports language\-specific fields. (See "Language\-specific fields and extras" about the concept). This option is for controlling them. .sp Specify "all" as to apply the parameter flags to all fields; all fields are enabled with specifying \(aq*\(aq as the parameter flags. If specifying nothing as the parameter flags ("\-\-fields\-all="), all extras are disabled. These two combinations are useful for testing. .TP .B \fB\-\-fields=[+|\-]flags|*\fP Specifies which available extension fields are to be included in the tag entries (see "TAG FILE FORMAT", below, and, "Fields", above, for more information). .sp The parameter flags is a set of one\-letter flags, each representing one type of extension field to include. Each letter or group of letters may be preceded by either \(aq+\(aq to add it to the default set, or \(aq\-\(aq to exclude it. In the absence of any preceding \(aq+\(aq or \(aq\-\(aq sign, only those fields explicitly listed in flags will be included in the output (i.e. overriding the default set). All fields are included if \(aq*\(aq is given. This option is ignored if the option \fB\-\-format=1\fP (legacy tag file format) has been specified. .sp This \fB\-\-fields=\fP option is for controlling fields common in all languages (or language\-independent fields). Universal\-ctags also supports language\-specific fields. (See "Language\-specific fields and extras" about the concept). Use \fB\-\-fields\-=\fP option for controlling them. .sp The meaning of major fields is as follows (one\-letter flag/name): .INDENT 7.0 .TP .B a/access Access (or export) of class members .TP .B e/end End lines of various items .TP .B f/file File\-restricted scoping. Enabled by default. .TP .B i/inherits Inheritance information. .TP .B k Kind of tag as a single letter. Enabled by default. Exceptionally this has no name. .TP .B K Kind of tag as full name Exceptionally this has no name. .TP .B l/language Language of source file containing tag .TP .B m/implementation Implementation information .TP .B n/line Line number of tag definition .TP .B p/scopeKind Kind of scope as full name .TP .B r/roles Roles assigned to the tag. For a definition tag, this field takes "def" as a value. .TP .B s Scope of tag definition. Enabled by default. Exceptionally this has no name. .TP .B S/signature Signature of routine (e.g. prototype or parameter list) .TP .B t/typeref Type and name of a variable, typedef or return type of callable like function as "typeref:" field. Enabled by default. .TP .B z/kind Include the "kind:" key in kind field .TP .B Z Include the "scope:" key in scope field. Exceptionally this has no name. .UNINDENT .sp Check the output of the \fB\-\-list\-fields\fP option for the other minor fields. .sp A name associated with a field can be used as alternative to a one\-letter flag. Some minor fields have no one\-letters flag. In that case, names must be specified anyway. See "Letters and names" for more details. .TP .B \fB\-\-file\-scope[=yes|no]\fP Indicates whether tags scoped only for a single file (i.e. tags which cannot be seen outside of the file in which they are defined, such as "static" tags) should be included in the output. See, also, the \fB\-h\fP option. This option is enabled by default. .sp Universal\-ctags provides an alternative way to control this option, with the "F/fileScope" extra, and recommends users to use the extra. However, this extra can cause issues. See ctags\-incompatibilities(7). .TP .B \fB\-\-filter[=yes|no]\fP Makes ctags\-universal behave as a filter, reading source file names from standard input and printing their tags to standard output on a file\-by\-file basis. If \fB\-\-sort\fP is enabled, tags are sorted only within the source file in which they are defined. File names are read from standard input in line\-oriented input mode (see note for \fB\-L\fP option) and only after file names listed on the command line or from any file supplied using the \fB\-L\fP option. When this option is enabled, the options \fB\-f\fP, \fB\-o\fP, and \fB\-\-totals\fP are ignored. This option is quite esoteric and is disabled by default. This option must appear before the first file name. .TP .B \fB\-\-filter\-terminator=string\fP Specifies a string to print to standard output following the tags for each file name parsed when the \fB\-\-filter\fP option is enabled. This may permit an application reading the output of ctags\-universal to determine when the output for each file is finished. Note that if the file name read is a directory and \fB\-\-recurse\fP is enabled, this string will be printed only once at the end of all tags found for by descending the directory. This string will always be separated from the last tag line for the file by its terminating newline. This option is quite esoteric and is empty by default. This option must appear before the first file name. .TP .B \fB\-\-format=level\fP Change the format of the output tag file. Currently the only valid values for level are 1 or 2. Level 1 specifies the original tag file format and level 2 specifies a new extended format containing extension fields (but in a manner which retains backward\-compatibility with original vi(1) implementations). The default level is 2. This option must appear before the first file name. [Ignored in etags mode] .TP .B \fB\-\-guess\-language\-eagerly\fP Looks into the file contents for heuristically guessing the proper language parser. See "Determining file language". .TP .B \fB\-\-help\fP Prints to standard output a detailed usage description, and then exits. .TP .B \fB\-\-help\-full\fP Prints to standard output a detailed usage description about experimental features, and then exits. Visit \fI\%http://docs.ctags.io/en/latest\fP for information about the latest exciting experimental features. .TP .B \fB\-\-if0[=yes|no]\fP Indicates a preference as to whether code within an "#if 0" branch of a preprocessor conditional should be examined for non\-macro tags (macro tags are always included). Because the intent of this construct is to disable code, the default value of this option is no. Note that this indicates a preference only and does not guarantee skipping code within an "#if 0" branch, since the fall\-back algorithm used to generate tags when preprocessor conditionals are too complex follows all branches of a conditional. This option is disabled by default. .TP .B \fB\-\-kinddef\-=letter,name,description\fP See ctags\-optlib(7). Be not confused this with \fB\-\-kinds\-\fP\&. .TP .B \fB\-\-kinds\-=[+|\-]kinds|*\fP Specifies a list of language\-specific kinds of tags (or kinds) to include in the output file for a particular language, where is case\-insensitive and is one of the built\-in language names (see the \fB\-\-list\-languages\fP option for a complete list). The parameter kinds is a group of one\-letter flags designating kinds of tags (particular to the language) to either include or exclude from the output. The specific sets of flags recognized for each language, their meanings and defaults may be list using the \fB\-\-list\-kinds\-full\fP option. Each letter or group of letters may be preceded by either \(aq+\(aq to add it to, or \(aq\-\(aq to remove it from, the default set. In the absence of any preceding \(aq+\(aq or \(aq\-\(aq sign, only those kinds explicitly listed in kinds will be included in the output (i.e. overriding the default for the specified language). .sp Specify \(aq*\(aq as the parameter to include all kinds implemented in in the output. Furthermore if "all" is given as , specification of the parameter kinds affects all languages defined in ctags\-universal. Giving "all" makes sense only when \(aq*\(aq is given as the parameter kinds. .sp As an example for the C language, in order to add prototypes and external variable declarations to the default set of tag kinds, but exclude macros, use "\-\-c\-kinds=+px\-d"; to include only tags for functions, use "\-\-c\-kinds=f". .sp A name associated with a kind can be used as alternative to a one\-letter flag. See "Letters and names" for more details. .TP .B \fB\-\-\-kinds=[+|\-]kinds|*\fP Equivalent to \fB\-\-kinds\-=...\fP\&. This option is kept for backward\-compatibility with Exuberant\-ctags. .TP .B \fB\-\-langdef=name\fP See ctags\-optlib(7). .TP .B \fB\-\-langmap=map[,map[...]]\fP Controls how file names are mapped to languages (see the \fB\-\-list\-maps\fP option). Each comma\-separated \fImap\fP consists of the language name (either a built\-in or user\-defined language), a colon, and a list of \fBfile extensions\fP and/or \fBfile name patterns\fP\&. A file extension is specified by preceding the extension with a period (e.g. ".c"). A file name pattern is specified by enclosing the pattern in parentheses (e.g. "([Mm]akefile)"). .sp If appropriate support is available from the runtime library of your C compiler, then the file name pattern may contain the usual shell wildcards common on Unix (be sure to quote the option parameter to protect the wildcards from being expanded by the shell before being passed to ctags\-universal). You can determine if shell wildcards are available on your platform by examining the output of the \fB\-\-list\-features\fP option, which will include "wildcards" in the compiled feature list; otherwise, the file name patterns are matched against file names using a simple textual comparison. .sp When mapping a file extension with \fB\-\-langmap\fP option, it will first be unmapped from any other languages. (\fB\-\-map\-\fP option provides more fine\-grained control.) .sp If the first character in a map is a plus sign (\(aq+\(aq), then the extensions and file name patterns in that map will be appended to the current map for that language; otherwise, the map will replace the current map. For example, to specify that only files with extensions of .c and .x are to be treated as C language files, use "\-\-langmap=c:.c.x"; to also add files with extensions of .j as Java language files, specify "\-\-langmap=c:.c.x,java:+.j". To map makefiles (e.g. files named either "Makefile", "makefile", or having the extension ".mak") to a language called "make", specify "\-\-langmap=make:([Mm]akefile).mak". To map files having no extension, specify a period not followed by a non\-period character (e.g. ".", "..x", ".x."). .sp To clear the mapping for a particular language (thus inhibiting automatic generation of tags for that language), specify an empty extension list (e.g. "\-\-langmap=fortran:"). To restore the default language mappings for a particular language, supply the keyword "default" for the mapping. To specify restore the default language mappings for all languages, specify "\-\-langmap=default". .sp Note that file name patterns are tested before file extensions when inferring the language of a file. This order of Universal\-ctags is different from Exuberant\-ctags. See ctags\-incompatibilities(7) for the background of this incompatible change. .TP .B \fB\-\-language\-force=language\fP By default, ctags\-universal automatically selects the language of a source file, ignoring those files whose language cannot be determined (see "SOURCE FILES", above). This option forces the specified \fIlanguage\fP (case\-insensitive; either built\-in or user\-defined) to be used for every supplied file instead of automatically selecting the language based upon its extension. In addition, the special value "auto" indicates that the language should be automatically selected (which effectively disables this option). .TP .B \fB\-\-languages=[+|\-]list\fP Specifies the languages for which tag generation is enabled, with \fIlist\fP containing a comma\-separated list of language names (case\-insensitive; either built\-in or user\-defined). If the first language of \fIlist\fP is not preceded by either a \(aq+\(aq or \(aq\-\(aq, the current list (the current settings of enabled/disabled languages managed in ctags\-universal internally) will be cleared before adding or removing the languages in \fIlist\fP\&. Until a \(aq\-\(aq is encountered, each language in the \fIlist\fP will be added to the current list. As either the \(aq+\(aq or \(aq\-\(aq is encountered in the \fIlist\fP, the languages following it are added or removed from the current list, respectively. Thus, it becomes simple to replace the current list with a new one, or to add or remove languages from the current list. .sp The actual list of files for which tags will be generated depends upon the language extension mapping in effect (see the \fB\-\-langmap\fP option). Note that the most of all languages, including user\-defined languages, are enabled unless explicitly disabled using this option. Language names included in list may be any built\-in language or one previously defined with \fB\-\-langdef\fP\&. The default is "all", which is also accepted as a valid argument. See the \fB\-\-list\-languages\fP option for a list of the all (built\-in and user\-defined) language names. .sp Note \fB\-\-languages=\fP option works cumulative way; the option can be specified with different arguments multiple times in a command line. .TP .B \fB\-\-license\fP Prints a summary of the software license to standard output, and then exits. .TP .B \fB\-\-line\-directives[=yes|no]\fP Specifies whether "#line" directives should be recognized. These are present in the output of preprocessors and contain the line number, and possibly the file name, of the original source file(s) from which the preprocessor output file was generated. When enabled, this option will cause ctags\-universal to generate tag entries marked with the file names and line numbers of their locations original source file(s), instead of their actual locations in the preprocessor output. The actual file names placed into the tag file will have the same leading path components as the preprocessor output file, since it is assumed that the original source files are located relative to the preprocessor output file (unless, of course, the #line directive specifies an absolute path). This option is off by default. Note: This option is generally only useful when used together with the \fB\-\-excmd=number\fP (\fB\-n\fP) option. Also, you may have to use either the \fB\-\-langmap\fP or \fB\-\-language\-force\fP option if the extension of the preprocessor output file is not known to ctags\-universal. .TP .B \fB\-\-links[=yes|no]\fP Indicates whether symbolic links (if supported) should be followed. When disabled, symbolic links are ignored. This option is on by default. .TP .B \fB\-\-list\-aliases[=language|all]\fP Lists the aliases for either the specified language or all languages, and then exits. The aliases are used when heuristically testing a language parser for a source file. .TP .B \fB\-\-list\-excludes\fP Lists the current exclusion patterns used to exclude files. .TP .B \fB\-\-list\-extras[=languages|all]\fP Lists the extras recognized for either the specified language or "all" languages. See "Extras" subsection to know what are extras. .sp An extra can be enabled or disabled with \fB\-\-extras=\fP for common extras in all languages, or \fB\-\-extras\-=\fP for the specified language. These option takes one\-letter flag or name as a parameter for specifying an extra. .sp The meaning of columns are as follows: .INDENT 7.0 .TP .B LETTER One\-letter flag. \(aq\-\(aq means the extra does not have one\-letter flag. .TP .B NAME The name of extra. The name is used in \fBextras:\fP field. .TP .B ENABLED Whether the extra is enabled or not. It takes "yes" or "no". .TP .B LANGUAGE The name of language if the extra is owned by a parser. "NONE" means the extra is common in parsers. .TP .B DESCRIPTION Human readable description for the extra. .UNINDENT .TP .B \fB\-\-list\-features\fP Lists the compiled features. .TP .B \fB\-\-list\-fields[=language|all]\fP Lists the fields recognized for either the specified language or "all" languages. See "Fields" subsection to know what are fields. .\" TODO? xref output . .sp A field can be enabled or disabled with \fB\-\-fields=\fP for common extras in all languages, or \fB\-\-fields\-=\fP for the specified language. These option takes one\-letter flag or name as a parameter for specifying a field. .sp The meaning of columns are as follows: .INDENT 7.0 .TP .B LETTER One\-letter flag. \(aq\-\(aq means the field does not have one\-letter flag. .TP .B NAME The name of field. .TP .B ENABLED Whether the field is enabled or not. It takes "yes" or "no". .TP .B LANGUAGE The name of language if the field is owned by a parser. "NONE" means the extra is common in parsers. .TP .B JSTYPE Json type used in printing the value of field when "\-\-output\-format=json" is specified. .sp Following characters are used for representing types. .INDENT 7.0 .TP .B s string .TP .B i integer .TP .B b boolean (true or false) .UNINDENT .sp The representation of this field and the output format used in "\-\-output\-format=json" are still experimental. .TP .B FIXED Whether this field can be disabled or not. Some fields are printed always in tags output. They have "yes" as the value for this column. .TP .B DESCRIPTION Human readable description for the field. .UNINDENT .TP .B \fB\-\-list\-kinds[=language|all]\fP Subset of \fB\-\-list\-kinds\-full\fP\&. This option is kept for backward\-compatibility with Exuberant\-ctags. .sp This option prints only LETTER, DESCRIPTION, and ENABLED fields of \fB\-\-list\-kinds\-full\fP output. However, the presentation of ENABLED column is different from that of \fB\-\-list\-kinds\-full\fP option; "[off]" follows after description if the kind is disabled, and nothing follows if enabled. The most of all kinds are enabled by default. .sp The critical weakness of this option is that this option does not print the name of kind. Universal\-ctags introduces \fB\-\-list\-kinds\-full\fP because it considers that names are important. .sp This option does not work with \fB\-\-machinable\fP nor \fB\-\-with\-list\-header\fP\&. .TP .B \fB\-\-list\-kinds\-full[=language|all]\fP Lists the tag kinds recognized for either the specified language or "all" languages, and then exits. See "Kinds" subsection to learn what kinds are. .sp Each kind of tag recorded in the tag file is represented by a one\-letter flag, or name. They are also used to filter the tags placed into the output through use of the \fB\-\-kinds\-\fP option. .sp The meaning of columns are as follows: .INDENT 7.0 .TP .B LANGUAGE The name of language having the kind. .TP .B LETTER One\-letter flag. This must be unique in a language. .TP .B NAME Name of the kind. This can be used as the alternative one\-letter flag described above. If enabling \(aqK\(aq field with \fB\-\-fields=+K\fP, ctags\-universal uses name instead of letter in tags output. To enable/disable a kind with \fB\-\-kinds\-\fP option, name surrounded by braces instead of letter. See "Letters and names" for details. This must be unique in a language. .TP .B ENABLED Whether the kind is enabled or not. It takes "yes" or "no". .TP .B REFONLY Whether the kind is specialized for reference tagging or not. If the column is "yes", the kind is for reference tagging, and it is never used for definition tagging. See also "TAG ENTRIES". .TP .B NROLES The number of roles this kind has. See also "Roles". .TP .B MASTER The master parser controlling enablement of the kind. A kind belongs to a language (owner) in Universal\-ctags; enabling and disabling a kind in a language has no effect on a kind in another language even if both kinds has the same letter and/or the same name. In other words, the namespace of kinds are separated by language. .sp However, Exuberant\-ctags does not separate the kinds of C and C++. Enabling/disabling kindX in C language enables/disables a kind in C++ language having the same name with kindX. To emulate this behavior in Universal\-ctags, a concept named "master parser" is introduced. Enabling/disabling some kinds are synchronized under the control of a master language. .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C $ ctags \-\-kinds\-C=+\(aq{local}\(aq \-\-list\-kinds\-full \e | grep \-E \(aq^(#|C\e+\e+ .* local)\(aq #LANGUAGE LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION C++ l local yes no 0 C local variables $ ctags \-\-kinds\-C=\-\(aq{local}\(aq \-\-list\-kinds\-full \e | grep \-E \(aq^(#|C\e+\e+ .* local)\(aq #LANGUAGE LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION C++ l local no no 0 C local variables .ft P .fi .UNINDENT .UNINDENT .sp You see "ENABLED" field of "local" kind of C++ language is changed Though "local" kind of C language is enabled/disabled. If you swap the languages, you see the same result. .TP .B DESCRIPTION Human readable description for the kind. .UNINDENT .TP .B \fB\-\-list\-languages\fP Lists the names of the languages understood by ctags\-universal, and then exits. These language names are case insensitive and may be used in many other options like \fB\-\-language\-force\fP, \fB\-\-languages\fP, \fB\-\-kinds\-\fP, \fB\-\-regex\-\fP, and so on. .sp Each language listed is disabled if followed by "[disabled]". To use the parser for such a language, specify the language as an argument of \fB\-\-languages=+\fP option. .sp This option does not work with \fB\-\-machinable\fP nor \fB\-\-with\-list\-header\fP\&. .TP .B \fB\-\-list\-map\-extensions[=language|all]\fP Lists the file extensions which associate a file name with a language for either the specified \fIlanguage\fP or \fBall\fP languages, and then exits. .TP .B \fB\-\-list\-map\-patterns[=language|all]\fP Lists the file name patterns which associate a file name with a language for either the specified \fIlanguage\fP or \fBall\fP languages, and then exits. .TP .B \fB\-\-list\-maps[=language|all]\fP Lists file name patterns and the file extensions which associate a file name with a language for either the specified \fIlanguage\fP or \fBall\fP languages, and then exits. See the \fB\-\-langmap\fP option, and "SOURCE FILES", above. .sp To list the file extensions or file name patterns individually, use \fB\-\-list\-map\-extensions\fP or \fB\-\-list\-map\-patterns\fP option. See the \fB\-\-langmap\fP option, and "SOURCE FILES", above. .sp This option does not work with \fB\-\-machinable\fP nor \fB\-\-with\-list\-header\fP\&. .TP .B \fB\-\-list\-regex\-flags\fP See ctags\-optlib(7). .TP .B \fB\-\-list\-roles[=language|all[.kinds]]\fP List the roles for either the specified language or "all" languages. If the parameter kinds is given after the parameter language or "all" with concatenating with \(aq.\(aq, list only roles defined in the kinds. Both one\-letter flags and names surrounded by braces are acceptable as the parameter kinds. .sp The meaning of columns are as follows: .INDENT 7.0 .TP .B LANGUAGE Name of language having the role. .TP .B KIND(L/N) One\-letter flag and name of kind having the role. .TP .B NAME Name of the role. .TP .B ENABLED Whether the kind is enabled or not. It takes "yes" or "no". (Currently all roles are enabled. No option for disabling a specified role is not implemented yet.) .TP .B DESCRIPTION Human readable description for the role. .UNINDENT .TP .B \fB\-\-machinable[=yes|no]\fP Use tab character as separators for \fB\-\-list\-\fP option output. It may be suitable for scripting. See "List options" for considered use cases. Disabled by default. .TP .B \fB\-\-map\-=[+|\-]extension|pattern\fP This option provides the way to control mapping(s) of file names to languages in a more fine\-grained way than \fB\-\-langmap\fP option. .sp In ctags\-universal, more than one language can map to a file name pattern or file extension (\fIN:1 map\fP). Alternatively, \fB\-\-langmap\fP option handle only \fI1:1 map\fP, only one language mapping to one file name pattern or file extension. A typical N:1 map is seen in C++ and ObjectiveC language; both languages have a map to ".h" as a file extension. .sp A file extension is specified by preceding the extension with a period (e.g. ".c"). A file name pattern is specified by enclosing the pattern in parentheses (e.g. "([Mm]akefile)"). A prefixed plus (\(aq+\(aq) sign is for adding, and minus (\(aq\-\(aq) is for removing. No prefix means replacing the map of \fI\fP\&. .sp Unlike \fB\-\-langmap\fP, \fIextension\fP (or \fIpattern\fP) is not a list. \fB\-\-map\-\fP takes one \fIextension\fP (or \fIpattern\fP). However, the option can be specified with different arguments multiple times in a command line. .TP .B \fB\-\-maxdepth\fP Limits the depth of directory recursion enabled with the \fB\-\-recurse\fP (\fB\-R\fP) option. .TP .B \fB\-\-options=pathname\fP Read additional options from file or directory. .sp ctags\-universal searches \fIpathname\fP in optlib path list first. If ctags\-universal cannot find a file or directory in the list, ctags\-universal reads a file or directory at the specified \fIpathname\fP\&. .sp If a file is specified, it should contain one option per line. If a directory is specified, files suffixed with ".ctags" under it are read in alphabetical order. .sp As a special case, if "\-\-options=NONE" is specified as the first option on the command line, preloading is disabled; the option will disable the automatic reading of any configuration options from either a file or the environment (see "FILES"). .TP .B \fB\-\-options\-maybe=pathname\fP Same as \fB\-\-options\fP but doesn\(aqt cause an error if file (or directory) specified with \fIpathname\fP doesn\(aqt exist. .TP .B \fB\-\-optlib\-dir=[+]directory\fP Add an optlib \fIdirectory\fP to or reset \fBoptlib\fP path list. By default, the optlib path list is empty. .TP .B \fB\-\-print\-language\fP Just prints the language parsers for specified source files, and then exits. .TP .B \fB\-\-quiet[=yes|no]\fP Write fewer messages (default is no). .TP .B \fB\-\-recurse[=yes|no]\fP Recurse into directories encountered in the list of supplied files. If the list of supplied files is empty and no file list is specified with the \-L option, then the current directory (i.e. ".") is assumed. Symbolic links are followed. If you don\(aqt like these behaviors, either explicitly specify the files or pipe the output of find(1) into ctags\-universal \-L\- instead. Note: This option is not supported on all platforms at present. It is available if the output of the \fB\-\-help\fP option includes this option. See, also, the \fB\-\-exclude\fP to limit recursion. .TP .B \fB\-\-regex\-=/regexp/replacement/[kind\-spec/][flags]\fP See ctags\-optlib(7). .TP .B \fB\-\-sort[=yes|no|foldcase]\fP Indicates whether the tag file should be sorted on the tag name (default is yes). Note that the original vi(1) required sorted tags. The foldcase value specifies case insensitive (or case\-folded) sorting. Fast binary searches of tag files sorted with case\-folding will require special support from tools using tag files, such as that found in the ctags\-universal readtags library, or Vim version 6.2 or higher (using "set ignorecase"). This option must appear before the first file name. [Ignored in etags mode] .TP .B \fB\-\-tag\-relative[=yes|no]\fP Indicates that the file paths recorded in the tag file should be relative to the directory containing the tag file, rather than relative to the current directory, unless the files supplied on the command line are specified with absolute paths. This option must appear before the first file name. The default is yes when running in etags mode (see the \fB\-e\fP option), no otherwise. .TP .B \fB\-\-totals[=yes|no]\fP Prints statistics about the source files read and the tag file written during the current invocation of ctags\-universal. This option is off by default. This option must appear before the first file name. .TP .B \fB\-\-verbose[=yes|no]\fP Enable verbose mode. This prints out information on option processing and a brief message describing what action is being taken for each file considered by ctags\-universal. Normally, ctags\-universal does not read command line arguments until after options are read from the configuration files (see "FILES", below) and the CTAGS environment variable. However, if this option is the first argument on the command line, it will take effect before any options are read from these sources. The default is no. .TP .B \fB\-\-version\fP Prints a version identifier for ctags\-universal to standard output, and then exits. This is guaranteed to always contain the string "Universal Ctags". .TP .B \fB\-\-with\-list\-header[=yes|no]\fP Print headers describing columns in \fB\-\-list\-\fP option output. See also "List options". .UNINDENT .SH OPERATIONAL DETAILS .sp As ctags\-universal considers each file name in turn, it tries to determine the language of the file by applying the following three tests in order: if the file extension has been mapped to a language, if the filename matches a shell pattern mapped to a language, and finally if the file is executable and its first line specifies an interpreter using the Unix\-style "#!" specification (if supported on the platform). Additionallly, if the \fB\-\-guess\-language\-eagerly\fP option is given, heuristic testing is also performed to determine if a language parser applies. (See "Determining file language") .sp If a language was identified, the file is opened and then the appropriate language parser is called to operate on the currently open file. The parser parses through the file and adds an entry to the tag file for each language object it is written to handle. See "TAG FILE FORMAT", below, for details on these entries. .sp This implementation of ctags\-universal imposes no formatting requirements on C code as do legacy implementations. Older implementations of ctags tended to rely upon certain formatting assumptions in order to help it resolve coding dilemmas caused by preprocessor conditionals. .sp In general, ctags\-universal tries to be smart about conditional preprocessor directives. If a preprocessor conditional is encountered within a statement which defines a tag, ctags\-universal follows only the first branch of that conditional (except in the special case of "#if 0", in which case it follows only the last branch). The reason for this is that failing to pursue only one branch can result in ambiguous syntax, as in the following example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C #ifdef TWO_ALTERNATIVES struct { #else union { #endif short a; long b; } .ft P .fi .UNINDENT .UNINDENT .sp Both branches cannot be followed, or braces become unbalanced and ctags\-universal would be unable to make sense of the syntax. .sp If the application of this heuristic fails to properly parse a file, generally due to complicated and inconsistent pairing within the conditionals, ctags\-universal will retry the file using a different heuristic which does not selectively follow conditional preprocessor branches, but instead falls back to relying upon a closing brace ("}") in column 1 as indicating the end of a block once any brace imbalance results from following a #if conditional branch. .sp ctags\-universal will also try to specially handle arguments lists enclosed in double sets of parentheses in order to accept the following conditional construct: .INDENT 0.0 .INDENT 3.5 extern void foo __ARGS((int one, char two)); .UNINDENT .UNINDENT .sp Any name immediately preceding the "((" will be automatically ignored and the previous name will be used. .sp C++ operator definitions are specially handled. In order for consistency with all types of operators (overloaded and conversion), the operator name in the tag file will always be preceded by the string "operator " (i.e. even if the actual operator definition was written as "operator<<"). .sp After creating or appending to the tag file, it is sorted by the tag name, removing identical tag lines. .SH TAG FILE FORMAT .sp When not running in etags mode, each entry in the tag file consists of a separate line, each looking like this in the most general case: .sp tag_namefile_nameex_cmd;"extension_fields .sp The fields and separators of these lines are specified as follows: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP 1. 3 tag name .IP 2. 3 single tab character .IP 3. 3 name of the file in which the object associated with the tag is located .IP 4. 3 single tab character .IP 5. 3 EX command used to locate the tag within the file; generally a search pattern (either /pattern/ or ?pattern?) or line number (see \fB\-\-excmd\fP). Tag file format 2 (see \fB\-\-format\fP) extends this EX command under certain circumstances to include a set of extension fields (described below) embedded in an EX comment immediately appended to the EX command, which leaves it backward\-compatible with original vi(1) implementations. .UNINDENT .UNINDENT .UNINDENT .sp A few special tags are written into the tag file for internal purposes. These tags are composed in such a way that they always sort to the top of the file. Therefore, the first two characters of these tags are used a magic number to detect a tag file for purposes of determining whether a valid tag file is being overwritten rather than a source file. .sp Note that the name of each source file will be recorded in the tag file exactly as it appears on the command line. Therefore, if the path you specified on the command line was relative to the current directory, then it will be recorded in that same manner in the tag file. See, however, the \fB\-\-tag\-relative\fP option for how this behavior can be modified. .sp Extension fields are tab\-separated key\-value pairs appended to the end of the EX command as a comment, as described above. These key value pairs appear in the general form "key:value". Their presence in the lines of the tag file are controlled by the \fB\-\-fields\fP option. The possible keys and the meaning of their values are as follows: .\" Q: this list is very out-of-date. Should we just say "use --list-fields"? . .INDENT 0.0 .TP .B access Indicates the visibility of this class member, where value is specific to the language. .TP .B file Indicates that the tag has file\-limited visibility. This key has no corresponding value. .TP .B kind Indicates the type, or kind, of tag. Its value is either one of the corresponding one\-letter flags described under the various \fB\-\-kinds\-\fP options above, or a full name. It is permitted (and is, in fact, the default) for the key portion of this field to be omitted. The optional behaviors are controlled with the \fB\-\-fields\fP option. .TP .B implementation When present, this indicates a limited implementation (abstract vs. concrete) of a routine or class, where value is specific to the language ("virtual" or "pure virtual" for C++; "abstract" for Java). .TP .B inherits When present, value. is a comma\-separated list of classes from which this class is derived (i.e. inherits from). .TP .B signature When present, value is a language\-dependent representation of the signature of a routine. A routine signature in its complete form specifies the return type of a routine and its formal argument list. This extension field is presently supported only for C\-based languages and does not include the return type. .UNINDENT .sp In addition, information on the scope of the tag definition may be available, with the key portion equal to some language\-dependent construct name and its value the name declared for that construct in the program. This scope entry indicates the scope in which the tag was found. For example, a tag generated for a C structure member would have a scope looking like "struct:myStruct". .SH HOW TO USE WITH VI .sp Vi will, by default, expect a tag file by the name "tags" in the current directory. Once the tag file is built, the following commands exercise the tag indexing feature: .INDENT 0.0 .TP .B vi \-t tag Start vi and position the cursor at the file and line where "tag" is defined. .TP .B :ta tag Find a tag. .TP .B Ctrl\-] Find the tag under the cursor. .TP .B Ctrl\-T Return to previous location before jump to tag (not widely implemented). .UNINDENT .SH HOW TO USE WITH GNU EMACS .sp Emacs will, by default, expect a tag file by the name "TAGS" in the current directory. Once the tag file is built, the following commands exercise the tag indexing feature: .INDENT 0.0 .TP .B M\-x visit\-tags\-table FILE Select the tag file, "FILE", to use. .TP .B M\-. [TAG] Find the first definition of TAG. The default tag is the identifier under the cursor. .TP .B M\-* Pop back to where you previously invoked "M\-.". .TP .B C\-u M\-. Find the next definition for the last tag. .UNINDENT .sp For more commands, see the Tags topic in the Emacs info document. .SH HOW TO USE WITH NEDIT .sp NEdit version 5.1 and later can handle the new extended tag file format (see \fB\-\-format\fP). To make NEdit use the tag file, select "File\->Load Tags File". To jump to the definition for a tag, highlight the word, then press Ctrl\-D. NEdit 5.1 can read multiple tag files from different directories. Setting the X resource nedit.tagFile to the name of a tag file instructs NEdit to automatically load that tag file at startup time. .SH CAVEATS .sp Because ctags\-universal is neither a preprocessor nor a compiler, use of preprocessor macros can fool ctags\-universal into either missing tags or improperly generating inappropriate tags. Although ctags\-universal has been designed to handle certain common cases, this is the single biggest cause of reported problems. In particular, the use of preprocessor constructs which alter the textual syntax of C can fool ctags\-universal. You can work around many such problems by using the \fB\-I\fP option. .sp Note that since ctags\-universal generates patterns for locating tags (see the \fB\-\-excmd\fP option), it is entirely possible that the wrong line may be found by your editor if there exists another source line which is identical to the line containing the tag. The following example demonstrates this condition: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C int variable; /* ... */ void foo(variable) int variable; { /* ... */ } .ft P .fi .UNINDENT .UNINDENT .sp Depending upon which editor you use and where in the code you happen to be, it is possible that the search pattern may locate the local parameter declaration in foo() before it finds the actual global variable definition, since the lines (and therefore their search patterns are identical). This can be avoided by use of the \fB\-\-excmd=n\fP option. .SH BUGS .sp ctags\-universal has more options than ls(1). .sp When parsing a C++ member function definition (e.g. "className::function"), ctags\-universal cannot determine whether the scope specifier is a class name or a namespace specifier and always lists it as a class name in the scope portion of the extension fields. Also, if a C++ function is defined outside of the class declaration (the usual case), the access specification (i.e. public, protected, or private) and implementation information (e.g. virtual, pure virtual) contained in the function declaration are not known when the tag is generated for the function definition. It will, however be available for prototypes (e.g. "\-\-c++\-kinds=+p"). .sp No qualified tags are generated for language objects inherited into a class. .SH ENVIRONMENT VARIABLES .INDENT 0.0 .TP .B CTAGS If this environment variable exists, it will be expected to contain a set of default options which are read when ctags\-universal starts, after the configuration files listed in FILES, below, are read, but before any command line options are read. Options appearing on the command line will override options specified in this variable. Only options will be read from this variable. Note that all white space in this variable is considered a separator, making it impossible to pass an option parameter containing an embedded space. If this is a problem, use a configuration file instead. .TP .B ETAGS Similar to the CTAGS variable above, this variable, if found, will be read when etags starts. If this variable is not found, etags will try to use CTAGS instead. .TP .B TMPDIR On Unix\-like hosts where mkstemp() is available, the value of this variable specifies the directory in which to place temporary files. This can be useful if the size of a temporary file becomes too large to fit on the partition holding the default temporary directory defined at compilation time. ctags\-universal creates temporary files only if either (1) an emacs\-style tag file is being generated, (2) the tag file is being sent to standard output, or (3) the program was compiled to use an internal sort algorithm to sort the tag files instead of the sort utility of the operating system. If the sort utility of the operating system is being used, it will generally observe this variable also. Note that if ctags\-universal is setuid, the value of TMPDIR will be ignored. .UNINDENT .SH FILES .sp $HOME/.ctags.d/*.ctags .sp $HOMEDRIVE$HOMEPATH/ctags.d/*.ctags (on MSWindows only) .sp \&.ctags.d/*.ctags .sp ctags.d/*.ctags .INDENT 0.0 .INDENT 3.5 If any of these configuration files exist, each will be expected to contain a set of default options which are read in the order listed when ctags\-universal starts, but before the CTAGS environment variable is read or any command line options are read. This makes it possible to set up personal or project\-level defaults. It is possible to compile ctags\-universal to read an additional configuration file before any of those shown above, which will be indicated if the output produced by the \fB\-\-version\fP option lists the "custom\-conf" feature. Options appearing in the CTAGS environment variable or on the command line will override options specified in these files. Only options will be read from these files. Note that the option files are read in line\-oriented mode in which spaces are significant (since shell quoting is not possible) but spaces at the beginning of a line are ignored. Each line of the file is read as one command line parameter (as if it were quoted with single quotes). Therefore, use new lines to indicate separate command\-line arguments. A line starting with \(aq#\(aq is treated as a comment. .sp *.ctags files in a directory are loaded in alphabetical order. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B tags The default tag file created by ctags\-universal. .TP .B TAGS The default tag file created by etags. .UNINDENT .SH SEE ALSO .sp See ctags\-optlib(7) for defining (or extending) a parser in a configuration file. .sp The official Universal\-ctags web site at: .sp \fI\%https://ctags.io/\fP .sp Also ex(1), vi(1), elvis, or, better yet, vim, the official editor of ctags. For more information on vim, see the VIM Pages web site at: .sp \fI\%http://www.vim.org/\fP .SH AUTHOR .sp Universal\-ctags project \fI\%https://ctags.io\fP .sp Darren Hiebert <\fI\%dhiebert@users.sourceforge.net\fP> \fI\%http://DarrenHiebert.com/\fP .SH MOTIVATION .sp "Think ye at all times of rendering some service to every member of the human race." .sp "All effort and exertion put forth by man from the fullness of his heart is worship, if it is prompted by the highest motives and the will to do service to humanity." .sp \-\- From the Baha\(aqi Writings .SH CREDITS .sp This version of ctags\-universal (Universal\-ctags) derived from the repository, known as \fBfishman\-ctags\fP, started by Reza Jelveh. .sp Some parsers are taken from \fBtagmanager\fP of \fBGeany\fP (\fI\%https://www.geany.org/\fP) project. .sp The fishman\-ctags was derived from Exuberant\-ctags. .sp Exuberant\-ctags was originally derived from and inspired by the ctags program by Steve Kirkendall <\fI\%kirkenda@cs.pdx.edu\fP> that comes with the Elvis vi clone (though virtually none of the original code remains). .sp Credit is also due Bram Moolenaar <\fI\%Bram@vim.org\fP>, the author of vim, who has devoted so much of his time and energy both to developing the editor as a service to others, and to helping the orphans of Uganda. .sp The section entitled "HOW TO USE WITH GNU EMACS" was shamelessly stolen from the info page for GNU etags. .\" Generated by docutils manpage writer. .