Home Explore Blog CI



neovim

9th chunk of `runtime/doc/tagsrch.txt`
9af0ac76eeb6a90de880a692fa2ef991d3dc4dfcaa97671f0000000100000fa2
 contain a <Tab>.
{tagaddress}	The Ex command that positions the cursor on the tag.  It can
		be any Ex command, although restrictions apply (see
		|tag-security|).  Posix only allows line numbers and search
		commands, which are mostly used.
{term}		;" The two characters semicolon and double quote.  This is
		interpreted by Vi as the start of a comment, which makes the
		following be ignored.  This is for backwards compatibility
		with Vi, it ignores the following fields. Example: >
			APP	file	/^static int APP;$/;"	v
<		When {tagaddress} is not a line number or search pattern, then
		{term} must be `|;"`.  Here the bar ends the command (excluding
		the bar) and `;"` is used to have Vi ignore the rest of the
		line.  Example: >
			APP	file.c	call cursor(3, 4)|;"	v

{field} ..	A list of optional fields.  Each field has the form:

			<Tab>{fieldname}:{value}

		The {fieldname} identifies the field, and can only contain
		alphabetical characters [a-zA-Z].
		The {value} is any string, but cannot contain a <Tab>.
		These characters are special:
			"\t" stands for a <Tab>
			"\r" stands for a <CR>
			"\n" stands for a <NL>
			"\\" stands for a single '\' character

		There is one field that doesn't have a ':'.  This is the kind
		of the tag.  It is handled like it was preceded with "kind:".
		In the above example, this was "kind:v" (typically variable).
		See the documentation of ctags for the kinds it produces, with
		ctags you can use `ctags --list-kinds` .

		The only other field currently recognized by Vim is "file:"
		(with an empty value).  It is used for a static tag.


The first lines in the tags file can contain lines that start with
	!_TAG_
These are sorted to the first lines, only rare tags that start with "!" can
sort to before them.  Vim recognizes two items.  The first one is the line
that indicates if the file was sorted.  When this line is found, Vim uses
binary searching for the tags file:
	!_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~

A tag file may be case-fold sorted to avoid a linear search when case is
ignored.  (Case is ignored when 'ignorecase' is set and 'tagcase' is
"followic", or when 'tagcase' is "ignore".)  See 'tagbsearch' for details.
The value '2' should be used then:
	!_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~

The other tag that Vim recognizes is the encoding of the tags file:
	!_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything} ~
Here "utf-8" is the encoding used for the tags.  Vim will then convert the tag
being searched for from 'encoding' to the encoding of the tags file.  And when
listing tags the reverse happens.  When the conversion fails the unconverted
tag is used.

							*tag-search*
The command can be any Ex command, but often it is a search command.
Examples:
	tag1	file1	/^main(argc, argv)/ ~
	tag2	file2	108 ~

The command is always executed with 'magic' not set.  The only special
characters in a search pattern are "^" (begin-of-line) and "$" (<EOL>).
See |pattern|.  Note that you must put a backslash before each backslash in
the search text.  This is for backwards compatibility with Vi.

							*E434* *E435*
If the command is a normal search command (it starts and ends with "/" or
"?"), some special handling is done:
- Searching starts on line 1 of the file.
  The direction of the search is forward for "/", backward for "?".
  Note that 'wrapscan' does not matter, the whole file is always searched.
- If the search fails, another try is done ignoring case.  If that fails too,
  a search is done for: >
	"^tagname[ \t]*("
<  (the tag with '^' prepended and "[ \t]*(" appended).  When using function
  names, this will find the function name when it is in column 0.  This will
  help when the arguments to the function have changed since the tags file was
  made.  If this search also fails another search is done with: >
	"^[#a-zA-Z_].*\<tagname[ \t]*("
<  This means: A line starting with '#' or an identifier and containing the tag
  followed by white space and a '('.  This will find macro names and function

Title: Tag File Format Details: Fields, Special Characters, and Search Commands
Summary
This section provides details on the structure and content of tags files used by Vim, including descriptions of fields like {tagaddress}, {term}, and optional fields ({field}). It specifies the special characters used within these fields and explains the format of the tag address as an Ex command. The section also covers special lines starting with "!_TAG_" for file sorting and encoding information, as well as how Vim searches for tags, including special handling for search commands and fallback searches for function names and macros.