📄 ctags.1
字号:
(case-insensitive; either built-in or user-defined) to be used for everysupplied file instead of automatically selecting the language based upon itsextension. In addition, the special value \fIauto\fP indicates that thelanguage should be automatically selected (which effectively disables thisoption)..TP 5\fB--languages\fP=\fI[+|-]list\fPSpecifies the languages for which tag generation is enabled, with \fIlist\fPcontaining a comma-separated list of language names (case-insensitive; eitherbuilt-in or user-defined). If the first language of \fIlist\fP is not precededby either a '+' or '-', the current list will be cleared before adding orremoving the languages in \fIlist\fP. Until a '-' is encountered, eachlanguage in the list will be added to the current list. As either the '+' or'-' is encountered in the list, the languages following it are added orremoved from the current list, respectively. Thus, it becomes simple toreplace the current list with a new one, or to add or remove languages fromthe current list. The actual list of files for which tags will be generateddepends upon the language extension mapping in effect (see the \fB--langmap\fPoption). Note that all languages, including user-defined languages are enabledunless explicitly disabled using this option. Language names included in\fIlist\fP may be any built-in language or one previously defined with\fB--langdef\fP. The default is "all", which is also accepted as a validargument. See the \fB--list-languages\fP option for a complete list of thebuilt-in language names..TP 5\fB--license\fPPrints a summary of the software license to standard output, and then exits..TP 5\fB--line-directives\fP[=\fIyes\fP|\fIno\fP]Specifies whether "#line" directives should be recognized. These are presentin the output of preprocessors and contain the line number, and possibly thefile name, of the original source file(s) from which the preprocessor outputfile was generated. When enabled, this option will cause \fBctags\fP togenerate tag entries marked with the file names and line numbers of theirlocations original source file(s), instead of their actual locations in thepreprocessor output. The actual file names placed into the tag file will havethe same leading path components as the preprocessor output file, since it isassumed that the original source files are located relative to thepreprocessor output file (unless, of course, the #line directive specifies anabsolute path). This option is off by default. \fBNote:\fP This option isgenerally only useful when used together with the \fB--excmd\fP=\fInumber\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 fileis not known to \fBctags\fP..TP 5\fB--links\fP[=\fIyes\fP|\fIno\fP]Indicates whether symbolic links (if supported) should be followed. Whendisabled, symbolic links are ignored. This option is on by default..TP 5\fB--list-kinds\fP[=\fIlanguage\fP|\fIall\fP]Lists the tag kinds recognized for either the specified language or alllanguages, and then exits. Each kind of tag recorded in the tag file isrepresented by a one-letter flag, which is also used to filter the tags placedinto the output through use of the \fB--<LANG>-kinds\fP option. Note that somelanguages and/or tag kinds may be implemented using regular expressions andmay not be available if regex support is not compiled into \fBctags\fP (seethe \fB--regex-<LANG>\fP option). Each kind listed is enabled unless followedby "[off]"..TP 5\fB--list-maps\fP[=\fIlanguage\fP|\fIall\fP]Lists the file extensions and file name patterns which associate a file namewith a language for either the specified language or all languages, and thenexits. See the \fB--langmap\fP option, and \fBSOURCE FILES\fP, above..TP 5\fB--list-languages\fPLists the names of the languages understood by \fBctags\fP, and then exits.These language names are case insensitive and may be used in the\fB--language-force\fP, \fB--languages\fP, \fB--<LANG>-kinds\fP, and\fB--regex-<LANG>\fP options..TP 5\fB--options\fP=\fIfile\fPRead additional options from \fIfile\fP. As a special case, if\fB--options\fP=\fINONE\fP is specified as the first option on the commandline, it will disable the automatic reading of any configuration options fromeither a file or the environment (see \fBFILES\fP)..TP 5\fB--recurse\fP[=\fIyes\fP|\fIno\fP]Recurse into directories encountered in the list of supplied files. If thelist of supplied files is empty and no file list is specified with the\fB-L\fP option, then the current directory (i.e. ".") is assumed. Symboliclinks are followed. If you don't like these behaviors, either explicitlyspecify the files or pipe the output of \fBfind\fP(1) into \fBctags -L-\fPinstead. \fBNote:\fP 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 5\fB--regex-<LANG>\fP=\fI/regexp/replacement/[kind-spec/][flags]\fPThe \fI/regexp/replacement/\fP pair define a regular expression replacementpattern, similar in style to \fBsed\fP substitution commands, with which togenerate tags from source files mapped to the named language, \fB<LANG>\fP,(case-insensitive; either a built-in or user-defined language). The regularexpression, \fIregexp\fP, defines an extended regular expression (roughly thatused by \fBegrep\fP(1)), which is used to locate a single source linecontaining a tag and may specify tab characters using \\t. When a matchingline is found, a tag will be generated for the name defined by\fIreplacement\fP, which generally will contain the special back-references\\1 through \\9 to refer to matching sub-expression groups within\fIregexp\fP. The '/' separator characters shown in the parameter to theoption can actually be replaced by any character. Note that whicheverseparator character is used will have to be escaped with a backslash ('\\')character wherever it is used in the parameter as something other than aseparator. The regular expression defined by this option is added to thecurrent list of regular expressions for the specified language unless theparameter is omitted, in which case the current list is cleared.Unless modified by \fIflags\fP, \fIregexp\fP is interpreted as a Posixextended regular expression. The \fIreplacement\fP should expand for allmatching lines to a non-empty string of characters, or a warning message willbe reported. An optional kind specifier for tags matching \fIregexp\fP mayfollow \fIreplacement\fP, which will determine what kind of tag is reported inthe "kind" extension field (see \fBTAG FILE FORMAT\fP, below). The full formof \fIkind-spec\fP is in the form of a single letter, a comma, a name (withoutspaces), a comma, a description, followed by a separator, which specifythe short and long forms of the kind value and its textual description(displayed using \fB--list-kinds\fP). Either the kind name and/or thedescription may be omitted. If \fIkind-spec\fP is omitted, it defaults to"\fIr,regex\fP". Finally, \fIflags\fP are one or more single-letter charactershaving the following effect upon the interpretation of \fIregexp\fP:.PP.RS 8.TP 4.I bThe pattern is interpreted as a Posix basic regular expression..TP 4.I eThe pattern is interpreted as a Posix extended regular expression (default)..TP 4.I iThe regular expression is to be applied in a case-insensitive manner..RE.RS 5Note that this option is available only if \fBctags\fP was compiled withsupport for regular expressions, which depends upon your platform. You candetermine if support for regular expressions is compiled in by examining theoutput of the \fB--version\fP option, which will include "+regex" in thecompiled feature list.For more information on the regular expressions used by \fBctags\fP, seeeither the \fBregex(5,7)\fP man page, or the GNU info documentation for regex(e.g. "info regex")..RE.TP 5\fB--sort\fP[=\fIyes\fP|\fIno\fP|\fIfoldcase\fP]Indicates whether the tag file should be sorted on the tag name (default is\fIyes\fP). Note that the original \fBvi\fP(1) required sorted tags. The \fIfoldcase\fP value specifies case insensitive (or case-folded) sorting.Fast binary searches of tag files sorted with case-folding will requirespecial support from tools using tag files, such as that found in the ctagsreadtags library, or Vim version 6.2 or higher (using "set ignorecase"). Thisoption must appear before the first file name. [Ignored in etags mode].TP 5\fB--tag-relative\fP[=\fIyes\fP|\fIno\fP]Indicates that the file paths recorded in the tag file should be relative tothe directory containing the tag file, rather than relative to the currentdirectory, unless the files supplied on the command line are specified withabsolute paths. This option must appear before the first file name. Thedefault is \fIyes\fP when running in etags mode (see the \fB-e\fPoption), \fIno\fP otherwise..TP 5\fB--totals\fP[=\fIyes\fP|\fIno\fP]Prints statistics about the source files read and the tag file written duringthe current invocation of \fBctags\fP. This option is off by default.This option must appear before the first file name..TP 5\fB--verbose\fP[=\fIyes\fP|\fIno\fP]Enable verbose mode. This prints out information on option processing and abrief message describing what action is being taken for each file consideredby \fBctags\fP. Normally, \fBctags\fP does not read command line argumentsuntil after options are read from the configuration files (see \fBFILES\fP,below) and the \fBCTAGS\fP environment variable. However, if this option isthe first argument on the command line, it will take effect before any optionsare read from these sources. The default is \fIno\fP..TP 5\fB--version\fPPrints a version identifier for \fBctags\fP to standard output, and thenexits. This is guaranteed to always contain the string "Exuberant Ctags"..SH "OPERATIONAL DETAILS"As \fBctags\fP considers each file name in turn, it tries to determine thelanguage of the file by applying the following three tests in order: if thefile extension has been mapped to a language, if the file name matches a shellpattern mapped to a language, and finally if the file is executable and itsfirst line specifies an interpreter using the Unix-style "#!" specification(if supported on the platform). If a language was identified, the file isopened and then the appropriate language parser is called to operate on thecurrently open file. The parser parses through the file and adds an entry tothe tag file for each language object it is written to handle. See\fBTAG FILE FORMAT\fP, below, for details on these entries.This implementation of \fBctags\fP imposes no formatting requirements on Ccode as do legacy implementations. Older implementations of ctags tended torely upon certain formatting assumptions in order to help it resolve codingdilemmas caused by preprocessor conditionals.In general, \fBctags\fP tries to be smart about conditional preprocessordirectives. If a preprocessor conditional is encountered within a statementwhich defines a tag, \fBctags\fP follows only the first branch of thatconditional (except in the special case of "#if 0", in which case it followsonly the last branch). The reason for this is that failing to pursue only onebranch can result in ambiguous syntax, as in the following example:.RS#ifdef TWO_ALTERNATIVES.brstruct {.br#else.brunion {.br#endif.RS 4short a;.brlong b;.RE}.REBoth branches cannot be followed, or braces become unbalanced and \fBctags\fPwould be unable to make sense of the syntax.If the application of this heuristic fails to properly parse a file,generally due to complicated and inconsistent pairing within the conditionals,\fBctags\fP will retry the file using a different heuristic which does notselectively follow conditional preprocessor branches, but instead falls backto relying upon a closing brace ("}") in column 1 as indicating the end of ablock once any brace imbalance results from following a #if conditional branch.\fBCtags\fP will also try to specially handle arguments lists enclosed indouble sets of parentheses in order to accept the following conditionalconstruct:.RSextern void foo __ARGS((int one, char two));.REAny name immediately preceding the "((" will be automatically ignored andthe previous name will be used.C++ operator definitions are specially handled. In order for consistency withall types of operators (overloaded and conversion), the operator name in thetag file will always be preceded by the string "operator " (i.e. even if theactual operator definition was written as "operator<<").After creating or appending to the tag file, it is sorted by the tag name,removing identical tag lines..SH "TAG FILE FORMAT"When not running in etags mode, each entry in the tag file consists of aseparate line, each looking like this in the most general case:.RS 1tag_name<TAB>file_name<TAB>ex_cmd;"<TAB>extension_fields.REThe fields and separators of these lines are specified as follows:.PD 0.RS 4.TP 41.tag name.TP 42.single tab character.TP 43.name of the file in which the object associated with the tag is located.TP 44.single tab character.TP 45.EX command used to locate the tag within the file; generally a search pattern
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -