Home Explore Blog CI



neovim

1st chunk of `runtime/doc/tagsrch.txt`
38a1114ee76d9343b1097443a93e8fafa70a42941d04e58c0000000100000fa3
*tagsrch.txt*   Nvim


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Tags and special searches				*tags-and-searches*

See section |29.1| of the user manual for an introduction.

                                      Type |gO| to see the table of contents.

==============================================================================
1. Jump to a tag					*tag-commands*

							*tag* *tags*
A tag is an identifier that appears in a "tags" file.  It is a sort of label
that can be jumped to.  For example: In C programs each function name can be
used as a tag.  The "tags" file has to be generated by a program like ctags,
before the tag commands can be used.

With the ":tag" command the cursor will be positioned on the tag.  With the
CTRL-] command, the keyword on which the cursor is standing is used as the
tag.  If the cursor is not on a keyword, the first keyword to the right of the
cursor is used.

The ":tag" command works very well for C programs.  If you see a call to a
function and wonder what that function does, position the cursor inside of the
function name and hit CTRL-].  This will bring you to the function definition.
An easy way back is with the CTRL-T command.  Also read about the tag stack
below.

						*:ta* *:tag* *E426* *E429*
:[count]ta[g][!] {name}
			Jump to the definition of {name}, using the
			information in the tags file(s).  Put {name} in the
			tag stack.  See |tag-!| for [!].
			{name} can be a regexp pattern, see |tag-regexp|.
			When there are several matching tags for {name}, jump
			to the [count] one.  When [count] is omitted the
			first one is jumped to. See |tag-matchlist| for
			jumping to other matching tags.

g<LeftMouse>						*g<LeftMouse>*
<C-LeftMouse>					*<C-LeftMouse>* *CTRL-]*
CTRL-]			Jump to the definition of the keyword under the
			cursor.  Same as ":tag {name}", where {name} is the
			keyword under or after cursor.
			When there are several matching tags for {name}, jump
			to the [count] one.  When no [count] is given the
			first one is jumped to. See |tag-matchlist| for
			jumping to other matching tags.

							*v_CTRL-]*
{Visual}CTRL-]		Same as ":tag {name}", where {name} is the text that
			is highlighted.

							*telnet-CTRL-]*
CTRL-] is the default telnet escape key.  When you type CTRL-] to jump to a
tag, you will get the telnet prompt instead.  Most versions of telnet allow
changing or disabling the default escape key.  See the telnet man page.  You
can `telnet -E {Hostname}` to disable the escape character, or
`telnet -e {EscapeCharacter} {Hostname}` to specify another escape character.
If possible, try to use "ssh" instead of "telnet" to avoid this problem.

							*tag-priority*
When there are multiple matches for a tag, this priority is used:
1. "FSC"  A full matching static tag for the current file.
2. "F C"  A full matching global tag for the current file.
3. "F  "  A full matching global tag for another file.
4. "FS "  A full matching static tag for another file.
5. " SC"  An ignore-case matching static tag for the current file.
6. "  C"  An ignore-case matching global tag for the current file.
7. "   "  An ignore-case matching global tag for another file.
8. " S "  An ignore-case matching static tag for another file.

Note that when the current file changes, the priority list is mostly not
changed, to avoid confusion when using ":tnext".  It is changed when using
":tag {name}".

The ignore-case matches are not found for a ":tag" command when:
- 'tagcase' is "followic" and the 'ignorecase' option is off
- 'tagcase' is "followscs" and the 'ignorecase' option is off and the
  'smartcase' option is off or the pattern contains an upper case character.
- 'tagcase' is "match"
- 'tagcase' is "smart" and the pattern contains an upper case character.

The ignore-case matches are found when:
- a pattern is used (starting with a "/")
- for ":tselect"
- when 'tagcase' is "followic" and 'ignorecase' is on
- when 'tagcase' is "followscs" and 'ignorecase' is on or the 'smartcase'

Title: Jumping to Tags in Vim
Summary
This section describes how to use tags in Vim to quickly jump to definitions of identifiers, such as function names in C programs. It covers the `:tag` command, CTRL-], and Visual mode CTRL-], as well as how Vim handles multiple tag matches based on priority. It also discusses the 'tagcase' option and its effect on ignore-case matching and how to avoid conflicts with the telnet escape key when using CTRL-].