📄 ctags.1
字号:
(either /pattern/ or ?pattern?) or line number (see \fB--excmd\fP). Tag fileformat 2 (see \fB--format\fP) extends this EX command under certaincircumstances to include a set of extension fields (described below) embeddedin an EX comment immediately appended to the EX command, which leaves itbackward-compatible with original \fBvi\fP(1) implementations..RE.PD 1A few special tags are written into the tag file for internal purposes. Thesetags 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 todetect a tag file for purposes of determining whether a valid tag file isbeing overwritten rather than a source file.Note that the name of each source file will be recorded in the tag fileexactly as it appears on the command line. Therefore, if the path youspecified on the command line was relative to the current directory, then itwill 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.Extension fields are tab-separated key-value pairs appended to the end of theEX command as a comment, as described above. These key value pairs appear inthe general form "\fIkey\fP:\fIvalue\fP". Their presence in the lines of thetag file are controlled by the \fB--fields\fP option. The possible keys andthe meaning of their values are as follows:.TP 12.I accessIndicates the visibility of this class member, where \fIvalue\fP is specificto the language..TP 12.I fileIndicates that the tag has file-limited visibility. This key has nocorresponding value..TP 12.I kindIndicates the type, or kind, of tag. Its value is either one of thecorresponding one-letter flags described under the various\fB--<LANG>-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. Theoptional behaviors are controlled with the \fB--fields\fP option..TP 12.I implementationWhen present, this indicates a limited implementation (abstract vs. concrete)of a routine or class, where \fIvalue\fP is specific to the language("virtual" or "pure virtual" for C++; "abstract" for Java)..TP 12.I inheritsWhen present, \fIvalue\fP. is a comma-separated list of classes from whichthis class is derived (i.e. inherits from)..TP 12.I signatureWhen present, \fIvalue\fP. is a language-dependent representation of thesignature of a routine. A routine signature in its complete form specifies thereturn type of a routine and its formal argument list. This extension field ispresently supported only for C-based languages and does not include the returntype..PPIn addition, information on the scope of the tag definition may be available,with the key portion equal to some language-dependent construct name and itsvalue the name declared for that construct in the program. This scope entryindicates the scope in which the tag was found. For example, a tag generatedfor a C structure member would have a scope looking like "struct:myStruct"..SH "HOW TO USE WITH VI"Vi will, by default, expect a tag file by the name "tags" in the currentdirectory. Once the tag file is built, the following commands exercise the tagindexing feature:.TP 12.B vi -t tagStart vi and position the cursor at the file and line where "tag" is defined..TP 12.B :ta tagFind a tag..TP 12.B Ctrl-]Find the tag under the cursor..TP 12.B Ctrl-TReturn to previous location before jump to tag (not widely implemented)..SH "HOW TO USE WITH GNU EMACS"Emacs will, by default, expect a tag file by the name "TAGS" in the currentdirectory. Once the tag file is built, the following commands exercise thetag indexing feature:.TP 10.B "M-x visit-tags-table <RET> FILE <RET>"Select the tag file, "FILE", to use..TP 10.B "M-. [TAG] <RET>"Find the first definition of TAG. The default tag is the identifier under thecursor..TP 10.B "M-*"Pop back to where you previously invoked "M-."..TP 10.B "C-u M-."Find the next definition for the last tag..PPFor more commands, see the \fITags\fP topic in the Emacs info document..SH "HOW TO USE WITH NEDIT"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 TagsFile". To jump to the definition for a tag, highlight the word, the pressCtrl-D. NEdit 5.1 can can read multiple tag files from different directories.Setting the X resource nedit.tagFile to the name of a tag file instructs NEditto automatically load that tag file at startup time..SH "CAVEATS"Because \fBctags\fP is neither a preprocessor nor a compiler, use ofpreprocessor macros can fool \fBctags\fP into either missing tags orimproperly generating inappropriate tags. Although \fBctags\fP has beendesigned to handle certain common cases, this is the single biggest cause ofreported problems. In particular, the use of preprocessor constructs whichalter the textual syntax of C can fool \fBctags\fP. You can work around manysuch problems by using the \fB-I\fP option.White space is treated as a separator for file names and options read fromlist files, specified using the \fB-L\fP option, and in filter mode (specifiedusing the \fB--filter\fP option). Therefore, it is not currently possible tosupply file names or other options containing embedded white space (spaces,etc.) through these options.Note that when \fBctags\fP generates uses patterns for locating tags (seethe \fB--excmd\fP option), it is entirely possible that the wrong line may befound by your editor if there exists another source line which is identical tothe line containing the tag. The following example demonstrates this condition:.RSint variable;/* ... */.brvoid foo(variable).brint variable;.br{.RS 4/* ... */.RE}.REDepending upon which editor you use and where in the code you happen to be, itis possible that the search pattern may locate the local parameter declarationin foo() before it finds the actual global variable definition, since thelines (and therefore their search patterns are identical). This can be avoidedby use of the \fB--excmd\fP=\fIn\fP option..SH "BUGS"\fBCtags\fP has more options than \fBls\fP(1).When parsing a C++ member function definition (e.g. "className::function"),\fBctags\fP cannot determine whether the scope specifier is a class name or anamespace specifier and always lists it as a class name in the scope portionof the extension fields. Also, if a C++ function is defined outside of theclass declaration (the usual case), the access specification (i.e. public,protected, or private) and implementation information (e.g. virtual, purevirtual) contained in the function declaration are not known when the tag isgenerated for the function definition. It will, however be available forprototypes (e.g \fB--c++-kinds\fP=\fI+p\fP).No qualified tags are generated for language objects inherited into a class..SH "ENVIRONMENT VARIABLES".TP 8.B CTAGSIf this environment variable exists, it will be expected to contain a set ofdefault options which are read when \fBctags\fP starts, after theconfiguration files listed in \fBFILES\fP, below, are read, but before anycommand line options are read. Options appearing on the command line willoverride options specified in this variable. Only options will be read fromthis variable. Note that all white space in this variable in considered aseparator, making it impossible to pass an option parameter containing anembedded space. If this is a problem, use a configuration file instead..TP 8.B ETAGSSimilar to the \fBCTAGS\fP variable above, this variable, if found, will beread when \fBetags\fP starts. If this variable is not found, \fBetags\fP willtry to use \fBCTAGS\fP instead..TP 8.B TMPDIROn Unix-like hosts where mkstemp() is available, the value of this variablespecifies the directory in which to place temporary files. This can be usefulif the size of a temporary file becomes too large to fit on the partitionholding the default temporary directory defined at compilation time.\fBctags\fP creates temporary files only if either (1) an emacs-style tag fileis 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 tagfiles instead of the the sort utility of the operating system. If the sortutility of the operating system is being used, it will generally observe thisvariable also. Note that if \fBctags\fP is setuid, the value of TMPDIR will beignored..SH "FILES".PD 0.I /ctags.cnf (on MSDOS, MSWindows only).br.I /etc/ctags.conf.br.I /usr/local/etc/ctags.conf.br.I $HOME/.ctags ($HOME/ctags.cnf on MSDOS, MSWindows).br.I .ctags (ctags.cnf on MSDOS, MSWindows).IPIf any of these configuration files exist, each will be expected to contain aset of default options which are read in the order listed when \fBctags\fPstarts, but before the \fBCTAGS\fP environment variable is read or any commandline options are read. This makes it possible to set up site-wide, personalor project-level defaults. It is possible to compile \fBctags\fP to read anadditional configuration file before any of those shown above, which will beindicated if the output produced by the \fB--version\fP option lists the"custom-conf" feature. Options appearing in the \fBCTAGS\fP environmentvariable or on the command line will override options specified in thesefiles. Only options will be read from these files. Note that the option filesare read in line-oriented mode in which spaces are significant (sinceshell quoting is not possible). Each line of the file is read as one commandline parameter (as if it were quoted with single quotes). Therefore, use newlines to indicate separate command-line arguments..PD 1.TP.I tagsThe default tag file created by \fBctags\fP..TP.I TAGSThe default tag file created by \fBetags\fP..SH "SEE ALSO"The official Exuberant Ctags web site at:.RShttp://ctags.sourceforge.net.REAlso \fBex\fP(1), \fBvi\fP(1), \fBelvis\fP, or, better yet, \fBvim\fP, theofficial editor of \fBctags\fP. For more information on \fBvim\fP, see the VIMPages web site at:.RShttp://www.vim.org/.RE.SH "AUTHOR"Darren Hiebert <dhiebert@users.sourceforge.net>.brhttp://DarrenHiebert.com/.SH "MOTIVATION""Think ye at all times of rendering some service to every member of the humanrace.""All effort and exertion put forth by man from the fullness of his heart isworship, if it is prompted by the highest motives and the will to do serviceto humanity.".RS\-- From the Baha'i Writings.RE.SH "CREDITS"This version of \fBctags\fP was originally derived from and inspired by thectags program by Steve Kirkendall <kirkenda@cs.pdx.edu> that comes with theElvis vi clone (though virtually none of the original code remains).Credit is also due Bram Moolenaar <Bram@vim.org>, the author of \fBvim\fP, whohas devoted so much of his time and energy both to developing the editor as aservice to others, and to helping the orphans of Uganda.The section entitled "HOW TO USE WITH GNU EMACS" was shamelessly stolen fromthe info page for GNU \fBetags\fP.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -