current file
is.
Instead of the comma a space may be used. Then a backslash is required for
the space to be included in the string option: >
:set tags=tags\ /home/user/commontags
To include a space in a file name use three backslashes. To include a comma
in a file name use two backslashes. For example, use: >
:set tags=tag\\\ file,/home/user/common\\,tags
for the files "tag file" and "/home/user/common,tags". The 'tags' option will
have the value "tag\ file,/home/user/common\,tags".
If the 'tagrelative' option is on (which is the default) and using a tag file
in another directory, file names in that tag file are relative to the
directory where the tag file is.
==============================================================================
5. Tags file format *tags-file-format* *E431*
*ctags*
A tags file can be created with an external command, for example "ctags". It
will contain a tag for each function. Some versions of "ctags" will also make
a tag for each "#defined" macro, typedefs, enums, etc.
Some programs that generate tags files:
ctags As found on most Unix systems. Only supports C. Only
does the basic work.
universal ctags A maintained version of ctags based on exuberant
ctags. See https://ctags.io.
*Exuberant_ctags*
exuberant ctags Works for C, C++, Java, Fortran, Eiffel and others.
See https://ctags.sourceforge.net. No new version
since 2009.
|:helptags| For Vim's |help| files
ptags.py For Python, in Python. Found in your Python source
directory at Tools/scripts/ptags.py.
ptags For Perl, in Perl. It can be found at
https://metacpan.org/pod/Vim::Tag
The lines in the tags file must have one of these two formats:
1. {tagname} {TAB} {tagfile} {TAB} {tagaddress}
2. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} ..
Previously an old format was supported, see |tag-old-static|.
The first format is a normal tag, which is completely compatible with Vi. It
is the only format produced by traditional ctags implementations. This is
often used for functions that are global, also referenced in other files.
The lines in the tags file can end in <NL> or <CR><NL>. On the Macintosh <CR>
also works. The <CR> and <NL> characters can never appear inside a line.
The second format is new. It includes additional information in optional
fields at the end of each line. It is backwards compatible with Vi. It is
only supported by new versions of ctags (such as Universal ctags or Exuberant
ctags).
{tagname} The identifier. Normally the name of a function, but it can
be any identifier. It cannot contain a <Tab>.
{TAB} One <Tab> character. Note: previous versions allowed any
white space here. This has been abandoned to allow spaces in
{tagfile}.
{tagfile} The file that contains the definition of {tagname}. It can
have an absolute or relative path. It may contain environment
variables and wildcards (although the use of wildcards is
doubtful). It cannot 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