代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>tagsrch - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>
<body>
<header>
<div class="header">
<a href="http://vim-jp.org/">vim-jp</a>
/ <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
/ tagsrch<br />
<a name="top"></a><h1>tagsrch - Vim Documentation</h1>
<a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
</div>
</header>
<nav>
<dl>
<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>
<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>
<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>
<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>
<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>
<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>
<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>
<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>
<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>
<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>
<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>
<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>
<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>
<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>
<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>
<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>
<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>
</dl>
</nav>
<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="tagsrch.html" name="tagsrch.txt">tagsrch.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2016 Sep 20<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
Tags and special searches <a class="Constant" href="tagsrch.html#tags-and-searches" name="tags-and-searches">tags-and-searches</a><br>
<br>
See section <a class="Identifier" href="usr_29.html#29.1">29.1</a> of the user manual for an introduction.<br>
<br>
1. Jump to a tag <a class="Identifier" href="tagsrch.html#tag-commands">tag-commands</a><br>
2. Tag stack <a class="Identifier" href="tagsrch.html#tag-stack">tag-stack</a><br>
3. Tag match list <a class="Identifier" href="tagsrch.html#tag-matchlist">tag-matchlist</a><br>
4. Tags details <a class="Identifier" href="tagsrch.html#tag-details">tag-details</a><br>
5. Tags file format <a class="Identifier" href="tagsrch.html#tags-file-format">tags-file-format</a><br>
6. Include file searches <a class="Identifier" href="tagsrch.html#include-search">include-search</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Jump to a tag <a class="Constant" href="tagsrch.html#tag-commands" name="tag-commands">tag-commands</a><br>
<br>
<a class="Constant" href="tagsrch.html#tag" name="tag">tag</a> <a class="Constant" href="tagsrch.html#tags" name="tags">tags</a><br>
A tag is an identifier that appears in a "tags" file. It is a sort of label<br>
that can be jumped to. For example: In C programs each function name can be<br>
used as a tag. The "tags" file has to be generated by a program like ctags,<br>
before the tag commands can be used.<br>
<br>
With the ":tag" command the cursor will be positioned on the tag. With the<br>
<span class="Special">CTRL-]</span> command, the keyword on which the cursor is standing is used as the<br>
tag. If the cursor is not on a keyword, the first keyword to the right of the<br>
cursor is used.<br>
<br>
The ":tag" command works very well for C programs. If you see a call to a<br>
function and wonder what that function does, position the cursor inside of the<br>
function name and hit <span class="Special">CTRL-]</span>. This will bring you to the function definition.<br>
An easy way back is with the <span class="Special">CTRL-T</span> command. Also read about the tag stack<br>
below.<br>
<br>
<a class="Constant" href="tagsrch.html#:ta" name=":ta">:ta</a> <a class="Constant" href="tagsrch.html#:tag" name=":tag">:tag</a> <a class="Constant" href="tagsrch.html#E426" name="E426">E426</a> <a class="Constant" href="tagsrch.html#E429" name="E429">E429</a><br>
:<span class="Special">[count]</span>ta[g][!] <span class="Special">{ident}</span><br>
Jump to the definition of <span class="Special">{ident}</span>, using the<br>
information in the tags file(s). Put <span class="Special">{ident}</span> in the<br>
tag stack. See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!].<br>
<span class="Special">{ident}</span> can be a regexp pattern, see <a class="Identifier" href="tagsrch.html#tag-regexp">tag-regexp</a>.<br>
When there are several matching tags for <span class="Special">{ident}</span>, jump<br>
to the <span class="Special">[count]</span> one. When <span class="Special">[count]</span> is omitted the<br>
first one is jumped to. See <a class="Identifier" href="tagsrch.html#tag-matchlist">tag-matchlist</a> for<br>
jumping to other matching tags.<br>
<br>
g<span class="Special"><LeftMouse></span> <a class="Constant" href="tagsrch.html#g<LeftMouse>" name="g<LeftMouse>">g<LeftMouse></a><br>
<span class="Special"><C-LeftMouse></span> <a class="Constant" href="tagsrch.html#<C-LeftMouse>" name="<C-LeftMouse>"><C-LeftMouse></a> <a class="Constant" href="tagsrch.html#CTRL-]" name="CTRL-]">CTRL-]</a><br>
<span class="Special">CTRL-]</span> Jump to the definition of the keyword under the<br>
cursor. Same as ":tag <span class="Special">{ident}</span>", where <span class="Special">{ident}</span> is the<br>
keyword under or after cursor.<br>
When there are several matching tags for <span class="Special">{ident}</span>, jump<br>
to the <span class="Special">[count]</span> one. When no <span class="Special">[count]</span> is given the<br>
first one is jumped to. See <a class="Identifier" href="tagsrch.html#tag-matchlist">tag-matchlist</a> for<br>
jumping to other matching tags.<br>
<span class="Special">{Vi: identifier after the cursor}</span><br>
<br>
<a class="Constant" href="tagsrch.html#v_CTRL-]" name="v_CTRL-]">v_CTRL-]</a><br>
<span class="Special">{Visual}CTRL-]</span> Same as ":tag <span class="Special">{ident}</span>", where <span class="Special">{ident}</span> is the text that<br>
is highlighted. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#telnet-CTRL-]" name="telnet-CTRL-]">telnet-CTRL-]</a><br>
<span class="Special">CTRL-]</span> is the default telnet escape key. When you type <span class="Special">CTRL-]</span> to jump to a<br>
tag, you will get the telnet prompt instead. Most versions of telnet allow<br>
changing or disabling the default escape key. See the telnet man page. You<br>
can 'telnet -E <span class="Special">{Hostname}</span>' to disable the escape character, or 'telnet -e<br>
<span class="Special">{EscapeCharacter}</span> <span class="Special">{Hostname}</span>' to specify another escape character. If<br>
possible, try to use "ssh" instead of "telnet" to avoid this problem.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-priority" name="tag-priority">tag-priority</a><br>
When there are multiple matches for a tag, this priority is used:<br>
1. "FSC" A full matching static tag for the current file.<br>
2. "F C" A full matching global tag for the current file.<br>
3. "F " A full matching global tag for another file.<br>
4. "FS " A full matching static tag for another file.<br>
5. " SC" An ignore-case matching static tag for the current file.<br>
6. " C" An ignore-case matching global tag for the current file.<br>
7. " " An ignore-case matching global tag for another file.<br>
8. " S " An ignore-case matching static tag for another file.<br>
<br>
<span class="Todo">Note</span> that when the current file changes, the priority list is mostly not<br>
changed, to avoid confusion when using ":tnext". It is changed when using<br>
":tag <span class="Special">{ident}</span>".<br>
<br>
The ignore-case matches are not found for a ":tag" command when:<br>
- the <a class="Type" href="options.html#'ignorecase'">'ignorecase'</a> option is off and <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followic"<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "match"<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "smart" and the pattern contains an upper case character.<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followscs" and <a class="Type" href="options.html#'smartcase'">'smartcase'</a> option is on and the pattern<br>
contains an upper case character.<br>
<br>
The ignore-case matches are found when:<br>
- a pattern is used (starting with a "/")<br>
- for ":tselect"<br>
- when <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followic" and <a class="Type" href="options.html#'ignorecase'">'ignorecase'</a> is off<br>
- when <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "match"<br>
- when <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followscs" and the <a class="Type" href="options.html#'smartcase'">'smartcase'</a> option is off<br>
<br>
<span class="Todo">Note</span> that using ignore-case tag searching disables binary searching in the<br>
tags file, which causes a slowdown. This can be avoided by fold-case sorting<br>
the tag file. See the <a class="Type" href="options.html#'tagbsearch'">'tagbsearch'</a> option for an explanation.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. Tag stack <a class="Constant" href="tagsrch.html#tag-stack" name="tag-stack">tag-stack</a> <a class="Constant" href="tagsrch.html#tagstack" name="tagstack">tagstack</a> <a class="Constant" href="tagsrch.html#E425" name="E425">E425</a><br>
<br>
On the tag stack is remembered which tags you jumped to, and from where.<br>
Tags are only pushed onto the stack when the <a class="Type" href="options.html#'tagstack'">'tagstack'</a> option is set.<br>
<br>
g<span class="Special"><RightMouse></span> <a class="Constant" href="tagsrch.html#g<RightMouse>" name="g<RightMouse>">g<RightMouse></a><br>
<span class="Special"><C-RightMouse></span> <a class="Constant" href="tagsrch.html#<C-RightMouse>" name="<C-RightMouse>"><C-RightMouse></a> <a class="Constant" href="tagsrch.html#CTRL-T" name="CTRL-T">CTRL-T</a><br>
<span class="Special">CTRL-T</span> Jump to <span class="Special">[count]</span> older entry in the tag stack<br>
(default 1). <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:po" name=":po">:po</a> <a class="Constant" href="tagsrch.html#:pop" name=":pop">:pop</a> <a class="Constant" href="tagsrch.html#E555" name="E555">E555</a> <a class="Constant" href="tagsrch.html#E556" name="E556">E556</a><br>
:<span class="Special">[count]</span>po[p][!] Jump to <span class="Special">[count]</span> older entry in tag stack (default 1).<br>
See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not in Vi}</span><br>
<br>
:<span class="Special">[count]</span>ta[g][!] Jump to <span class="Special">[count]</span> newer entry in tag stack (default 1).<br>
See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tags" name=":tags">:tags</a><br>
:tags Show the contents of the tag stack. The active<br>
entry is marked with a '>'. <span class="Special">{not in Vi}</span><br>
<br>
The output of ":tags" looks like this:<br>
<br>
# TO tag FROM line in file/text<br>
1 1 main 1 harddisk2:text/vim/test<br>
> 2 2 FuncA 58 i = FuncA(10);<br>
3 1 FuncC 357 harddisk2:text/vim/src/amiga.c<br>
<br>
This list shows the tags that you jumped to and the cursor position before<br>
that jump. The older tags are at the top, the newer at the bottom.<br>
<br>
The '>' points to the active entry. This is the tag that will be used by the<br>
next ":tag" command. The <span class="Special">CTRL-T</span> and ":pop" command will use the position<br>
above the active entry.<br>
<br>
Below the "TO" is the number of the current match in the match list. <span class="Todo">Note</span><br>
that this doesn't change when using ":pop" or ":tag".<br>
<br>
The line number and file name are remembered to be able to get back to where<br>
you were before the tag command. The line number will be correct, also when<br>
deleting/inserting lines, unless this was done by another program (e.g.<br>
another instance of Vim).<br>
<br>
For the current file, the "file/text" column shows the text at the position.<br>
An indent is removed and a long line is truncated to fit in the window.<br>
<br>
You can jump to previously used tags with several commands. Some examples:<br>
<br>
":pop" or <span class="Special">CTRL-T</span> to position before previous tag<br>
<span class="Special">{count}CTRL-T</span> to position before <span class="Special">{count}</span> older tag<br>
":tag" to newer tag<br>
":0tag" to last used tag<br>
<br>
The most obvious way to use this is while browsing through the call graph of<br>
a program. Consider the following call graph:<br>
<br>
main ---> FuncA ---> FuncC<br>
---> FuncB<br>
<br>
(Explanation: main calls FuncA and FuncB; FuncA calls FuncC).<br>
You can get from main to FuncA by using <span class="Special">CTRL-]</span> on the call to FuncA. Then<br>
you can <span class="Special">CTRL-]</span> to get to FuncC. If you now want to go back to main you can<br>
use <span class="Special">CTRL-T</span> twice. Then you can <span class="Special">CTRL-]</span> to FuncB.<br>
<br>
If you issue a ":ta <span class="Special">{ident}</span>" or <span class="Special">CTRL-]</span> command, this tag is inserted at the<br>
current position in the stack. If the stack was full (it can hold up to 20<br>
entries), the oldest entry is deleted and the older entries shift one<br>
position up (their index number is decremented by one). If the last used<br>
entry was not at the bottom, the entries below the last used one are<br>
deleted. This means that an old branch in the call graph is lost. After the<br>
commands explained above the tag stack will look like this:<br>
<br>
# TO tag FROM line in file/text<br>
1 1 main 1 harddisk2:text/vim/test<br>
2 1 FuncB 59 harddisk2:text/vim/src/main.c<br>
<br>
<a class="Constant" href="tagsrch.html#E73" name="E73">E73</a><br>
When you try to use the tag stack while it doesn't contain anything you will<br>
get an error message.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Tag match list <a class="Constant" href="tagsrch.html#tag-matchlist" name="tag-matchlist">tag-matchlist</a> <a class="Constant" href="tagsrch.html#E427" name="E427">E427</a> <a class="Constant" href="tagsrch.html#E428" name="E428">E428</a><br>
<br>
When there are several matching tags, these commands can be used to jump<br>
between them. <span class="Todo">Note</span> that these commands don't change the tag stack, they keep<br>
the same entry.<br>
<br>
<a class="Constant" href="tagsrch.html#:ts" name=":ts">:ts</a> <a class="Constant" href="tagsrch.html#:tselect" name=":tselect">:tselect</a><br>
:ts[elect][!] <span class="Special">[ident]</span> List the tags that match <span class="Special">[ident]</span>, using the<br>
information in the tags file(s).<br>
When <span class="Special">[ident]</span> is not given, the last tag name from the<br>
tag stack is used.<br>
With a '>' in the first column is indicated which is<br>
the current position in the list (if there is one).<br>
<span class="Special">[ident]</span> can be a regexp pattern, see <a class="Identifier" href="tagsrch.html#tag-regexp">tag-regexp</a>.<br>
See <a class="Identifier" href="tagsrch.html#tag-priority">tag-priority</a> for the priorities used in the<br>
listing. <span class="Special">{not in Vi}</span><br>
Example output:<br>
<br>
<br>
<div class="helpExample"> nr pri kind tag file<br>
1 F f mch_delay os_amiga.c<br>
mch_delay(msec, ignoreinput)<br>
> 2 F f mch_delay os_msdos.c<br>
mch_delay(msec, ignoreinput)<br>
3 F f mch_delay os_unix.c<br>
mch_delay(msec, ignoreinput)<br>
Enter nr of choice (<CR> to abort):</div>
<br>
See <a class="Identifier" href="tagsrch.html#tag-priority">tag-priority</a> for the "pri" column. <span class="Todo">Note</span> that<br>
this depends on the current file, thus using<br>
":tselect xxx" can produce different results.<br>
The "kind" column gives the kind of tag, if this was<br>
included in the tags file.<br>
The "info" column shows information that could be<br>
found in the tags file. It depends on the program<br>
that produced the tags file.<br>
When the list is long, you may get the <a class="Identifier" href="message.html#more-prompt">more-prompt</a>.<br>
If you already see the tag you want to use, you can<br>
type 'q' and enter the number.<br>
<br>
<a class="Constant" href="tagsrch.html#:sts" name=":sts">:sts</a> <a class="Constant" href="tagsrch.html#:stselect" name=":stselect">:stselect</a><br>
:sts[elect][!] <span class="Special">[ident]</span> Does ":tselect[!] <span class="Special">[ident]</span>" and splits the window for<br>
the selected tag. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#g]" name="g]">g]</a><br>
g] Like <span class="Special">CTRL-]</span>, but use ":tselect" instead of ":tag".<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#v_g]" name="v_g]">v_g]</a><br>
<span class="Special">{Visual}</span>g] Same as "g]", but use the highlighted text as the<br>
identifier. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tj" name=":tj">:tj</a> <a class="Constant" href="tagsrch.html#:tjump" name=":tjump">:tjump</a><br>
:tj[ump][!] <span class="Special">[ident]</span> Like ":tselect", but jump to the tag directly when<br>
there is only one match. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:stj" name=":stj">:stj</a> <a class="Constant" href="tagsrch.html#:stjump" name=":stjump">:stjump</a><br>
:stj[ump][!] <span class="Special">[ident]</span> Does ":tjump[!] <span class="Special">[ident]</span>" and splits the window for the<br>
selected tag. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#g_CTRL-]" name="g_CTRL-]">g_CTRL-]</a><br>
g <span class="Special">CTRL-]</span> Like <span class="Special">CTRL-]</span>, but use ":tjump" instead of ":tag".<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#v_g_CTRL-]" name="v_g_CTRL-]">v_g_CTRL-]</a><br>
<span class="Special">{Visual}</span>g <span class="Special">CTRL-]</span> Same as "g <span class="Special">CTRL-]</span>", but use the highlighted text as<br>
the identifier. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tn" name=":tn">:tn</a> <a class="Constant" href="tagsrch.html#:tnext" name=":tnext">:tnext</a><br>
:<span class="Special">[count]</span>tn[ext][!] Jump to <span class="Special">[count]</span> next matching tag (default 1). See<br>
<a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tp" name=":tp">:tp</a> <a class="Constant" href="tagsrch.html#:tprevious" name=":tprevious">:tprevious</a><br>
:<span class="Special">[count]</span>tp[revious][!] Jump to <span class="Special">[count]</span> previous matching tag (default 1).<br>
See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tN" name=":tN">:tN</a> <a class="Constant" href="tagsrch.html#:tNext" name=":tNext">:tNext</a><br>
:<span class="Special">[count]</span>tN[ext][!] Same as ":tprevious". <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tr" name=":tr">:tr</a> <a class="Constant" href="tagsrch.html#:trewind" name=":trewind">:trewind</a><br>
:<span class="Special">[count]</span>tr[ewind][!] Jump to first matching tag. If <span class="Special">[count]</span> is given, jump<br>
to <span class="Special">[count]</span>th matching tag. See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not</span><br>
<span class="Special">in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tf" name=":tf">:tf</a> <a class="Constant" href="tagsrch.html#:tfirst" name=":tfirst">:tfirst</a><br>
:<span class="Special">[count]</span>tf[irst][!] Same as ":trewind". <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:tl" name=":tl">:tl</a> <a class="Constant" href="tagsrch.html#:tlast" name=":tlast">:tlast</a><br>
:tl[ast][!] Jump to last matching tag. See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!]. <span class="Special">{not</span><br>
<span class="Special">in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:lt" name=":lt">:lt</a> <a class="Constant" href="tagsrch.html#:ltag" name=":ltag">:ltag</a><br>
:lt[ag][!] <span class="Special">[ident]</span> Jump to tag <span class="Special">[ident]</span> and add the matching tags to a new<br>
location list for the current window. <span class="Special">[ident]</span> can be<br>
a regexp pattern, see <a class="Identifier" href="tagsrch.html#tag-regexp">tag-regexp</a>. When <span class="Special">[ident]</span> is<br>
not given, the last tag name from the tag stack is<br>
used. The search pattern to locate the tag line is<br>
prefixed with "\V" to escape all the special<br>
characters (very nomagic). The location list showing<br>
the matching tags is independent of the tag stack.<br>
See <a class="Identifier" href="tagsrch.html#tag-!">tag-!</a> for [!].<br>
<span class="Special">{not in Vi}</span><br>
<br>
When there is no other message, Vim shows which matching tag has been jumped<br>
to, and the number of matching tags:<br>
<div class="helpExample"> tag 1 of 3 or more</div>
The " or more" is used to indicate that Vim didn't try all the tags files yet.<br>
When using ":tnext" a few times, or with ":tlast", more matches may be found.<br>
<br>
When you didn't see this message because of some other message, or you just<br>
want to know where you are, this command will show it again (and jump to the<br>
same tag as last time):<br>
<div class="helpExample"> :0tn</div>
<br>
<a class="Constant" href="tagsrch.html#tag-skip-file" name="tag-skip-file">tag-skip-file</a><br>
When a matching tag is found for which the file doesn't exist, this match is<br>
skipped and the next matching tag is used. Vim reports this, to notify you of<br>
missing files. When the end of the list of matches has been reached, an error<br>
message is given.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-preview" name="tag-preview">tag-preview</a><br>
The tag match list can also be used in the preview window. The commands are<br>
the same as above, with a "p" prepended.<br>
<span class="Special">{not available when compiled without the </span><a class="Identifier" href="various.html#+quickfix">+quickfix</a><span class="Special"> feature}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:pts" name=":pts">:pts</a> <a class="Constant" href="tagsrch.html#:ptselect" name=":ptselect">:ptselect</a><br>
:pts[elect][!] <span class="Special">[ident]</span> Does ":tselect[!] <span class="Special">[ident]</span>" and shows the new tag in a<br>
"Preview" window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a> for more info.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptj" name=":ptj">:ptj</a> <a class="Constant" href="tagsrch.html#:ptjump" name=":ptjump">:ptjump</a><br>
:ptj[ump][!] <span class="Special">[ident]</span> Does ":tjump[!] <span class="Special">[ident]</span>" and shows the new tag in a<br>
"Preview" window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a> for more info.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptn" name=":ptn">:ptn</a> <a class="Constant" href="tagsrch.html#:ptnext" name=":ptnext">:ptnext</a><br>
:<span class="Special">[count]</span>ptn[ext][!] ":tnext" in the preview window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a>.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptp" name=":ptp">:ptp</a> <a class="Constant" href="tagsrch.html#:ptprevious" name=":ptprevious">:ptprevious</a><br>
:<span class="Special">[count]</span>ptp[revious][!] ":tprevious" in the preview window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a>.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptN" name=":ptN">:ptN</a> <a class="Constant" href="tagsrch.html#:ptNext" name=":ptNext">:ptNext</a><br>
:<span class="Special">[count]</span>ptN[ext][!] Same as ":ptprevious". <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptr" name=":ptr">:ptr</a> <a class="Constant" href="tagsrch.html#:ptrewind" name=":ptrewind">:ptrewind</a><br>
:<span class="Special">[count]</span>ptr[ewind][!] ":trewind" in the preview window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a>.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptf" name=":ptf">:ptf</a> <a class="Constant" href="tagsrch.html#:ptfirst" name=":ptfirst">:ptfirst</a><br>
:<span class="Special">[count]</span>ptf[irst][!] Same as ":ptrewind". <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ptl" name=":ptl">:ptl</a> <a class="Constant" href="tagsrch.html#:ptlast" name=":ptlast">:ptlast</a><br>
:ptl[ast][!] ":tlast" in the preview window. See <a class="Identifier" href="windows.html#:ptag">:ptag</a>.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. Tags details <a class="Constant" href="tagsrch.html#tag-details" name="tag-details">tag-details</a><br>
<br>
<a class="Constant" href="tagsrch.html#static-tag" name="static-tag">static-tag</a><br>
A static tag is a tag that is defined for a specific file. In a C program<br>
this could be a static function.<br>
<br>
In Vi jumping to a tag sets the current search pattern. This means that<br>
the "n" command after jumping to a tag does not search for the same pattern<br>
that it did before jumping to the tag. Vim does not do this as we consider it<br>
to be a bug. You can still find the tag search pattern in the search history.<br>
If you really want the old Vi behavior, set the 't' flag in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-binary-search" name="tag-binary-search">tag-binary-search</a><br>
Vim uses binary searching in the tags file to find the desired tag quickly<br>
(when enabled at compile time <a class="Identifier" href="various.html#+tag_binary">+tag_binary</a>). But this only works if the<br>
tags file was sorted on ASCII byte value. Therefore, if no match was found,<br>
another try is done with a linear search. If you only want the linear search,<br>
reset the <a class="Type" href="options.html#'tagbsearch'">'tagbsearch'</a> option. Or better: Sort the tags file!<br>
<br>
<span class="Todo">Note</span> that the binary searching is disabled when not looking for a tag with a<br>
specific name. This happens when ignoring case and when a regular expression<br>
is used that doesn't start with a fixed string. Tag searching can be a lot<br>
slower then. The former can be avoided by case-fold sorting the tags file.<br>
See <a class="Type" href="options.html#'tagbsearch'">'tagbsearch'</a> for details.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-regexp" name="tag-regexp">tag-regexp</a><br>
The ":tag" and ":tselect" commands accept a regular expression argument. See<br>
<a class="Identifier" href="pattern.html#pattern">pattern</a> for the special characters that can be used.<br>
When the argument starts with '/', it is used as a pattern. If the argument<br>
does not start with '/', it is taken literally, as a full tag name.<br>
Examples:<br>
<div class="helpExample"> :tag main</div>
jumps to the tag "main" that has the highest priority.<br>
<div class="helpExample"> :tag /^get</div>
jumps to the tag that starts with "get" and has the highest priority.<br>
<div class="helpExample"> :tag /norm</div>
lists all the tags that contain "norm", including "id_norm".<br>
When the argument both exists literally, and match when used as a regexp, a<br>
literal match has a higher priority. For example, ":tag /open" matches "open"<br>
before "open_file" and "file_open".<br>
When using a pattern case is ignored. If you want to match case use "\C" in<br>
the pattern.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-!" name="tag-!">tag-!</a><br>
If the tag is in the current file this will always work. Otherwise the<br>
performed actions depend on whether the current file was changed, whether a !<br>
is added to the command and on the <a class="Type" href="options.html#'autowrite'">'autowrite'</a> option:<br>
<br>
<span class="PreProc">tag in file autowrite </span><br>
<span class="PreProc">current file changed ! option action</span><br>
<span class="PreProc">-----------------------------------------------------------------------------</span><br>
yes x x x goto tag<br>
no no x x read other file, goto tag<br>
no yes yes x abandon current file, read other file, goto<br>
tag<br>
no yes no on write current file, read other file, goto<br>
tag<br>
no yes no off fail<br>
<span class="PreProc">-----------------------------------------------------------------------------</span><br>
<br>
- If the tag is in the current file, the command will always work.<br>
- If the tag is in another file and the current file was not changed, the<br>
other file will be made the current file and read into the buffer.<br>
- If the tag is in another file, the current file was changed and a ! is<br>
added to the command, the changes to the current file are lost, the other<br>
file will be made the current file and read into the buffer.<br>
- If the tag is in another file, the current file was changed and the<br>
<a class="Type" href="options.html#'autowrite'">'autowrite'</a> option is on, the current file will be written, the other<br>
file will be made the current file and read into the buffer.<br>
- If the tag is in another file, the current file was changed and the<br>
<a class="Type" href="options.html#'autowrite'">'autowrite'</a> option is off, the command will fail. If you want to save<br>
the changes, use the ":w" command and then use ":tag" without an argument.<br>
This works because the tag is put on the stack anyway. If you want to lose<br>
the changes you can use the ":tag!" command.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-security" name="tag-security">tag-security</a><br>
<span class="Todo">Note</span> that Vim forbids some commands, for security reasons. This works like<br>
using the <a class="Type" href="options.html#'secure'">'secure'</a> option for exrc/vimrc files in the current directory. See<br>
<a class="Identifier" href="starting.html#trojan-horse">trojan-horse</a> and <a class="Identifier" href="eval.html#sandbox">sandbox</a>.<br>
When the <span class="Special">{tagaddress}</span> changes a buffer, you will get a warning message:<br>
"WARNING: tag command changed a buffer!!!"<br>
In a future version changing the buffer will be impossible. All this for<br>
security reasons: Somebody might hide a nasty command in the tags file, which<br>
would otherwise go unnoticed. Example:<br>
<div class="helpExample"> :$d|/tag-function-name/</div>
{this security prevention is not present in Vi}<br>
<br>
In Vi the ":tag" command sets the last search pattern when the tag is searched<br>
for. In Vim this is not done, the previous search pattern is still remembered,<br>
unless the 't' flag is present in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>. The search pattern is always<br>
put in the search history, so you can modify it if searching fails.<br>
<br>
<a class="Constant" href="tagsrch.html#emacs-tags" name="emacs-tags">emacs-tags</a> <a class="Constant" href="tagsrch.html#emacs_tags" name="emacs_tags">emacs_tags</a> <a class="Constant" href="tagsrch.html#E430" name="E430">E430</a><br>
Emacs style tag files are only supported if Vim was compiled with the<br>
<a class="Identifier" href="various.html#+emacs_tags">+emacs_tags</a> feature enabled. Sorry, there is no explanation about Emacs tag<br>
files here, it is only supported for backwards compatibility :-).<br>
<br>
Lines in Emacs tags files can be very long. Vim only deals with lines of up<br>
to about 510 bytes. To see whether lines are ignored set <a class="Type" href="options.html#'verbose'">'verbose'</a> to 5 or<br>
higher.<br>
<br>
<a class="Constant" href="tagsrch.html#tags-option" name="tags-option">tags-option</a><br>
The <a class="Type" href="options.html#'tags'">'tags'</a> option is a list of file names. Each of these files is searched<br>
for the tag. This can be used to use a different tags file than the default<br>
file "tags". It can also be used to access a common tags file.<br>
<br>
The next file in the list is not used when:<br>
- A matching static tag for the current buffer has been found.<br>
- A matching global tag has been found.<br>
This also depends on whether case is ignored. Case is ignored when:<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followic" and <a class="Type" href="options.html#'ignorecase'">'ignorecase'</a> is set<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "ignore"<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "smart" and the pattern only contains lower case<br>
characters.<br>
- <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "followscs" and <a class="Type" href="options.html#'smartcase'">'smartcase'</a> is set and the pattern only<br>
contains lower case characters.<br>
If case is not ignored, and the tags file only has a match without matching<br>
case, the next tags file is searched for a match with matching case. If no<br>
tag with matching case is found, the first match without matching case is<br>
used. If case is ignored, and a matching global tag with or without matching<br>
case is found, this one is used, no further tags files are searched.<br>
<br>
When a tag file name starts with "./", the '.' is replaced with the path of<br>
the current file. This makes it possible to use a tags file in the directory<br>
where the current file is (no matter what the current directory is). The idea<br>
of using "./" is that you can define which tag file is searched first: In the<br>
current directory ("tags,./tags") or in the directory of the current file<br>
("./tags,tags").<br>
<br>
For example:<br>
<div class="helpExample"> :set tags=./tags,tags,/home/user/commontags</div>
<br>
In this example the tag will first be searched for in the file "tags" in the<br>
directory where the current file is. Next the "tags" file in the current<br>
directory. If it is not found there, then the file "/home/user/commontags"<br>
will be searched for the tag.<br>
<br>
This can be switched off by including the 'd' flag in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>, to make<br>
it Vi compatible. "./tags" will then be the tags file in the current<br>
directory, instead of the tags file in the directory where the current file<br>
is.<br>
<br>
Instead of the comma a space may be used. Then a backslash is required for<br>
the space to be included in the string option:<br>
<div class="helpExample"> :set tags=tags\ /home/user/commontags</div>
<br>
To include a space in a file name use three backslashes. To include a comma<br>
in a file name use two backslashes. For example, use:<br>
<div class="helpExample"> :set tags=tag\\\ file,/home/user/common\\,tags</div>
<br>
for the files "tag file" and "/home/user/common,tags". The <a class="Type" href="options.html#'tags'">'tags'</a> option will<br>
have the value "tag\ file,/home/user/common\,tags".<br>
<br>
If the <a class="Type" href="options.html#'tagrelative'">'tagrelative'</a> option is on (which is the default) and using a tag file<br>
in another directory, file names in that tag file are relative to the<br>
directory where the tag file is.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Tags file format <a class="Constant" href="tagsrch.html#tags-file-format" name="tags-file-format">tags-file-format</a> <a class="Constant" href="tagsrch.html#E431" name="E431">E431</a><br>
<br>
<a class="Constant" href="tagsrch.html#ctags" name="ctags">ctags</a> <a class="Constant" href="tagsrch.html#jtags" name="jtags">jtags</a><br>
A tags file can be created with an external command, for example "ctags". It<br>
will contain a tag for each function. Some versions of "ctags" will also make<br>
a tag for each "#defined" macro, typedefs, enums, etc.<br>
<br>
Some programs that generate tags files:<br>
ctags As found on most Unix systems. Only supports C. Only<br>
does the basic work.<br>
<a class="Constant" href="tagsrch.html#Exuberant_ctags" name="Exuberant_ctags">Exuberant_ctags</a><br>
exuberant ctags This a very good one. It works for C, C++, Java,<br>
Fortran, Eiffel and others. It can generate tags for<br>
many items. See <span class="Constant"><a href="http://ctags.sourceforge.net">http://ctags.sourceforge.net</a></span>.<br>
etags Connected to Emacs. Supports many languages.<br>
JTags For Java, in Java. It can be found at<br>
<span class="Constant"><a href="http://www.fleiner.com/jtags/">http://www.fleiner.com/jtags/</a></span>.<br>
ptags.py For Python, in Python. Found in your Python source<br>
directory at Tools/scripts/ptags.py.<br>
ptags For Perl, in Perl. It can be found at<br>
<span class="Constant"><a href="http://www.eleves.ens.fr:8080/home/nthiery/Tags/">http://www.eleves.ens.fr:8080/home/nthiery/Tags/</a></span>.<br>
gnatxref For Ada. See <span class="Constant"><a href="http://www.gnuada.org/">http://www.gnuada.org/</a></span>. gnatxref is<br>
part of the gnat package.<br>
<br>
<br>
The lines in the tags file must have one of these three formats:<br>
<br>
1. <span class="Special">{tagname}</span> <span class="Special">{TAB}</span> <span class="Special">{tagfile}</span> <span class="Special">{TAB}</span> <span class="Special">{tagaddress}</span><br>
2. <span class="Special">{tagfile}</span>:<span class="Special">{tagname}</span> <span class="Special">{TAB}</span> <span class="Special">{tagfile}</span> <span class="Special">{TAB}</span> <span class="Special">{tagaddress}</span><br>
3. <span class="Special">{tagname}</span> <span class="Special">{TAB}</span> <span class="Special">{tagfile}</span> <span class="Special">{TAB}</span> <span class="Special">{tagaddress}</span> <span class="Special">{term}</span> <span class="Special">{field}</span> ..<br>
<br>
The first is a normal tag, which is completely compatible with Vi. It is the<br>
only format produced by traditional ctags implementations. This is often used<br>
for functions that are global, also referenced in other files.<br>
<br>
The lines in the tags file can end in <span class="Special"><LF></span> or <span class="Special"><CR><LF></span>. On the Macintosh <span class="Special"><CR></span><br>
also works. The <span class="Special"><CR></span> and <span class="Special"><NL></span> characters can never appear inside a line.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-old-static" name="tag-old-static">tag-old-static</a><br>
The second format is for a static tag only. It is obsolete now, replaced by<br>
the third format. It is only supported by Elvis 1.x and Vim and a few<br>
versions of ctags. A static tag is often used for functions that are local,<br>
only referenced in the file <span class="Special">{tagfile}</span>. <span class="Todo">Note</span> that for the static tag, the two<br>
occurrences of <span class="Special">{tagfile}</span> must be exactly the same. Also see <a class="Identifier" href="tagsrch.html#tags-option">tags-option</a><br>
below, for how static tags are used.<br>
<br>
The third format is new. It includes additional information in optional<br>
fields at the end of each line. It is backwards compatible with Vi. It is<br>
only supported by new versions of ctags (such as Exuberant ctags).<br>
<br>
<span class="Special">{tagname}</span> The identifier. Normally the name of a function, but it can<br>
be any identifier. It cannot contain a <span class="Special"><Tab></span>.<br>
<span class="Special">{TAB}</span> One <span class="Special"><Tab></span> character. <span class="Todo">Note</span>: previous versions allowed any<br>
white space here. This has been abandoned to allow spaces in<br>
<span class="Special">{tagfile}</span>. It can be re-enabled by including the<br>
<a class="Identifier" href="various.html#+tag_any_white">+tag_any_white</a> feature at compile time. <a class="Constant" href="tagsrch.html#tag-any-white" name="tag-any-white">tag-any-white</a><br>
<span class="Special">{tagfile}</span> The file that contains the definition of <span class="Special">{tagname}</span>. It can<br>
have an absolute or relative path. It may contain environment<br>
variables and wildcards (although the use of wildcards is<br>
doubtful). It cannot contain a <span class="Special"><Tab></span>.<br>
<span class="Special">{tagaddress}</span> The Ex command that positions the cursor on the tag. It can<br>
be any Ex command, although restrictions apply (see<br>
<a class="Identifier" href="tagsrch.html#tag-security">tag-security</a>). Posix only allows line numbers and search<br>
commands, which are mostly used.<br>
<span class="Special">{term}</span> ;" The two characters semicolon and double quote. This is<br>
interpreted by Vi as the start of a comment, which makes the<br>
following be ignored. This is for backwards compatibility<br>
with Vi, it ignores the following fields.<br>
<span class="Special">{field}</span> .. A list of optional fields. Each field has the form:<br>
<br>
<span class="Special"><Tab>{fieldname}</span>:<span class="Special">{value}</span><br>
<br>
The <span class="Special">{fieldname}</span> identifies the field, and can only contain<br>
alphabetical characters <span class="Special">[a-zA-Z]</span>.<br>
The <span class="Special">{value}</span> is any string, but cannot contain a <span class="Special"><Tab></span>.<br>
These characters are special:<br>
"\t" stands for a <span class="Special"><Tab></span><br>
"\r" stands for a <span class="Special"><CR></span><br>
"\n" stands for a <span class="Special"><NL></span><br>
"\\" stands for a single '\' character<br>
<br>
There is one field that doesn't have a ':'. This is the kind<br>
of the tag. It is handled like it was preceded with "kind:".<br>
See the documentation of ctags for the kinds it produces.<br>
<br>
The only other field currently recognized by Vim is "file:"<br>
(with an empty value). It is used for a static tag.<br>
<br>
The first lines in the tags file can contain lines that start with<br>
!_TAG_<br>
These are sorted to the first lines, only rare tags that start with "!" can<br>
sort to before them. Vim recognizes two items. The first one is the line<br>
that indicates if the file was sorted. When this line is found, Vim uses<br>
binary searching for the tags file:<br>
<span class="PreProc">!_TAG_FILE_SORTED<Tab>1<Tab>{anything}</span><br>
<br>
A tag file may be case-fold sorted to avoid a linear search when case is<br>
ignored. (Case is ignored when <a class="Type" href="options.html#'ignorecase'">'ignorecase'</a> is set and <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is<br>
"followic", or when <a class="Type" href="options.html#'tagcase'">'tagcase'</a> is "ignore".) See <a class="Type" href="options.html#'tagbsearch'">'tagbsearch'</a> for details.<br>
The value '2' should be used then:<br>
<span class="PreProc">!_TAG_FILE_SORTED<Tab>2<Tab>{anything}</span><br>
<br>
The other tag that Vim recognizes, but only when compiled with the<br>
<a class="Identifier" href="various.html#+multi_byte">+multi_byte</a> feature, is the encoding of the tags file:<br>
<span class="PreProc">!_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything}</span><br>
Here "utf-8" is the encoding used for the tags. Vim will then convert the tag<br>
being searched for from <a class="Type" href="options.html#'encoding'">'encoding'</a> to the encoding of the tags file. And when<br>
listing tags the reverse happens. When the conversion fails the unconverted<br>
tag is used.<br>
<br>
<a class="Constant" href="tagsrch.html#tag-search" name="tag-search">tag-search</a><br>
The command can be any Ex command, but often it is a search command.<br>
Examples:<br>
<span class="PreProc">tag1 file1 /^main(argc, argv)/</span><br>
<span class="PreProc">tag2 file2 108</span><br>
<br>
The command is always executed with <a class="Type" href="options.html#'magic'">'magic'</a> not set. The only special<br>
characters in a search pattern are "^" (begin-of-line) and "$" (<span class="Special"><EOL></span>).<br>
See <a class="Identifier" href="pattern.html#pattern">pattern</a>. <span class="Todo">Note</span> that you must put a backslash before each backslash in<br>
the search text. This is for backwards compatibility with Vi.<br>
<br>
<a class="Constant" href="tagsrch.html#E434" name="E434">E434</a> <a class="Constant" href="tagsrch.html#E435" name="E435">E435</a><br>
If the command is a normal search command (it starts and ends with "/" or<br>
"?"), some special handling is done:<br>
- Searching starts on line 1 of the file.<br>
The direction of the search is forward for "/", backward for "?".<br>
<span class="Todo">Note</span> that <a class="Type" href="options.html#'wrapscan'">'wrapscan'</a> does not matter, the whole file is always searched. (Vi<br>
does use <a class="Type" href="options.html#'wrapscan'">'wrapscan'</a>, which caused tags sometimes not be found.) <span class="Special">{Vi starts</span><br>
<span class="Special">searching in line 2 of another file. It does not find a tag in line 1 of</span><br>
<span class="Special">another file when 'wrapscan' is not set}</span><br>
- If the search fails, another try is done ignoring case. If that fails too,<br>
a search is done for:<br>
"^tagname[ \t]*("<br>
(the tag with '^' prepended and "[ \t]*(" appended). When using function<br>
names, this will find the function name when it is in column 0. This will<br>
help when the arguments to the function have changed since the tags file was<br>
made. If this search also fails another search is done with:<br>
"^[#a-zA-Z_].*\<tagname[ \t]*("<br>
This means: A line starting with '#' or an identifier and containing the tag<br>
followed by white space and a '('. This will find macro names and function<br>
names with a type prepended. {the extra searches are not in Vi}<br>
<br>
<span class="PreProc">==============================================================================</span><br>
6. Include file searches <a class="Constant" href="tagsrch.html#include-search" name="include-search">include-search</a> <a class="Constant" href="tagsrch.html#definition-search" name="definition-search">definition-search</a><br>
<a class="Constant" href="tagsrch.html#E387" name="E387">E387</a> <a class="Constant" href="tagsrch.html#E388" name="E388">E388</a> <a class="Constant" href="tagsrch.html#E389" name="E389">E389</a><br>
<br>
These commands look for a string in the current file and in all encountered<br>
included files (recursively). This can be used to find the definition of a<br>
variable, function or macro. If you only want to search in the current<br>
buffer, use the commands listed at <a class="Identifier" href="pattern.html#pattern-searches">pattern-searches</a>.<br>
<br>
These commands are not available when the <a class="Identifier" href="various.html#+find_in_path">+find_in_path</a> feature was disabled<br>
at compile time.<br>
<br>
When a line is encountered that includes another file, that file is searched<br>
before continuing in the current buffer. Files included by included files are<br>
also searched. When an include file could not be found it is silently<br>
ignored. Use the <a class="Identifier" href="tagsrch.html#:checkpath">:checkpath</a> command to discover which files could not be<br>
found, possibly your <a class="Type" href="options.html#'path'">'path'</a> option is not set up correctly. <span class="Todo">Note</span>: the<br>
included file is searched, not a buffer that may be editing that file. Only<br>
for the current file the lines in the buffer are used.<br>
<br>
The string can be any keyword or a defined macro. For the keyword any match<br>
will be found. For defined macros only lines that match with the <a class="Type" href="options.html#'define'">'define'</a><br>
option will be found. The default is "^#\s*define", which is for C programs.<br>
For other languages you probably want to change this. See <a class="Type" href="options.html#'define'">'define'</a> for an<br>
example for C++. The string cannot contain an end-of-line, only matches<br>
within a line are found.<br>
<br>
When a match is found for a defined macro, the displaying of lines continues<br>
with the next line when a line ends in a backslash.<br>
<br>
The commands that start with "[" start searching from the start of the current<br>
file. The commands that start with "]" start at the current cursor position.<br>
<br>
The <a class="Type" href="options.html#'include'">'include'</a> option is used to define a line that includes another file. The<br>
default is "\^#\s*include", which is for C programs. <span class="Todo">Note</span>: Vim does not<br>
recognize C syntax, if the <a class="Type" href="options.html#'include'">'include'</a> option matches a line inside<br>
"#ifdef/#endif" or inside a comment, it is searched anyway. The <a class="Type" href="options.html#'isfname'">'isfname'</a><br>
option is used to recognize the file name that comes after the matched<br>
pattern.<br>
<br>
The <a class="Type" href="options.html#'path'">'path'</a> option is used to find the directory for the include files that<br>
do not have an absolute path.<br>
<br>
The <a class="Type" href="options.html#'comments'">'comments'</a> option is used for the commands that display a single line or<br>
jump to a line. It defines patterns that may start a comment. Those lines<br>
are ignored for the search, unless [!] is used. One exception: When the line<br>
matches the pattern "^# *define" it is not considered to be a comment.<br>
<br>
If you want to list matches, and then select one to jump to, you could use a<br>
mapping to do that for you. Here is an example:<br>
<br>
<div class="helpExample"> :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR></div>
<br>
<a class="Constant" href="tagsrch.html#[i" name="[i">[i</a><br>
[i Display the first line that contains the keyword<br>
under the cursor. The search starts at the beginning<br>
of the file. Lines that look like a comment are<br>
ignored (see <a class="Type" href="options.html#'comments'">'comments'</a> option). If a count is given,<br>
the count'th matching line is displayed, and comment<br>
lines are not ignored. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]i" name="]i">]i</a><br>
]i like "[i", but start at the current cursor position.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:is" name=":is">:is</a> <a class="Constant" href="tagsrch.html#:isearch" name=":isearch">:isearch</a><br>
:<span class="Special">[range]</span>is[earch][!] <span class="Special">[count]</span> [/]pattern[/]<br>
Like "[i" and "]i", but search in <span class="Special">[range]</span> lines<br>
(default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#[I" name="[I">[I</a><br>
[I Display all lines that contain the keyword under the<br>
cursor. Filenames and line numbers are displayed<br>
for the found lines. The search starts at the<br>
beginning of the file. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]I" name="]I">]I</a><br>
]I like "[I", but start at the current cursor position.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:il" name=":il">:il</a> <a class="Constant" href="tagsrch.html#:ilist" name=":ilist">:ilist</a><br>
:<span class="Special">[range]</span>il[ist][!] [/]pattern[/]<br>
Like "[I" and "]I", but search in <span class="Special">[range]</span> lines<br>
(default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#[_CTRL-I" name="[_CTRL-I">[_CTRL-I</a><br>
[ <span class="Special">CTRL-I</span> Jump to the first line that contains the keyword<br>
under the cursor. The search starts at the beginning<br>
of the file. Lines that look like a comment are<br>
ignored (see <a class="Type" href="options.html#'comments'">'comments'</a> option). If a count is given,<br>
the count'th matching line is jumped to, and comment<br>
lines are not ignored. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]_CTRL-I" name="]_CTRL-I">]_CTRL-I</a><br>
] <span class="Special">CTRL-I</span> like "[ <span class="Special">CTRL-I</span>", but start at the current cursor<br>
position. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ij" name=":ij">:ij</a> <a class="Constant" href="tagsrch.html#:ijump" name=":ijump">:ijump</a><br>
:<span class="Special">[range]</span>ij[ump][!] <span class="Special">[count]</span> [/]pattern[/]<br>
Like "[ <span class="Special">CTRL-I</span>" and "] <span class="Special">CTRL-I</span>", but search in<br>
<span class="Special">[range]</span> lines (default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<span class="Special">CTRL-W</span> <span class="Special">CTRL-I</span> <a class="Constant" href="tagsrch.html#CTRL-W_CTRL-I" name="CTRL-W_CTRL-I">CTRL-W_CTRL-I</a> <a class="Constant" href="tagsrch.html#CTRL-W_i" name="CTRL-W_i">CTRL-W_i</a><br>
<span class="Special">CTRL-W</span> i Open a new window, with the cursor on the first line<br>
that contains the keyword under the cursor. The<br>
search starts at the beginning of the file. Lines<br>
that look like a comment line are ignored (see<br>
<a class="Type" href="options.html#'comments'">'comments'</a> option). If a count is given, the count'th<br>
matching line is jumped to, and comment lines are not<br>
ignored. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:isp" name=":isp">:isp</a> <a class="Constant" href="tagsrch.html#:isplit" name=":isplit">:isplit</a><br>
:<span class="Special">[range]</span>isp[lit][!] <span class="Special">[count]</span> [/]pattern[/]<br>
Like "<span class="Special">CTRL-W</span> i" and "<span class="Special">CTRL-W</span> i", but search in<br>
<span class="Special">[range]</span> lines (default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#[d" name="[d">[d</a><br>
[d Display the first macro definition that contains the<br>
macro under the cursor. The search starts from the<br>
beginning of the file. If a count is given, the<br>
count'th matching line is displayed. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]d" name="]d">]d</a><br>
]d like "[d", but start at the current cursor position.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:ds" name=":ds">:ds</a> <a class="Constant" href="tagsrch.html#:dsearch" name=":dsearch">:dsearch</a><br>
:<span class="Special">[range]</span>ds[earch][!] <span class="Special">[count]</span> [/]string[/]<br>
Like "[d" and "]d", but search in <span class="Special">[range]</span> lines<br>
(default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#[D" name="[D">[D</a><br>
[D Display all macro definitions that contain the macro<br>
under the cursor. Filenames and line numbers are<br>
displayed for the found lines. The search starts<br>
from the beginning of the file. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]D" name="]D">]D</a><br>
]D like "[D", but start at the current cursor position.<br>
<span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:dli" name=":dli">:dli</a> <a class="Constant" href="tagsrch.html#:dlist" name=":dlist">:dlist</a><br>
:<span class="Special">[range]</span>dli[st][!] [/]string[/]<br>
Like <a class="Comment" href="tagsrch.html#[D">[D</a> and <a class="Comment" href="tagsrch.html#]D">]D</a>, but search in <span class="Special">[range]</span> lines<br>
(default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<span class="Todo">Note</span> that <a class="Comment" href="change.html#:dl">:dl</a> works like <a class="Comment" href="change.html#:delete">:delete</a> with the "l"<br>
flag, not <a class="Comment" href="tagsrch.html#:dlist">:dlist</a>.<br>
<br>
<a class="Constant" href="tagsrch.html#[_CTRL-D" name="[_CTRL-D">[_CTRL-D</a><br>
[ <span class="Special">CTRL-D</span> Jump to the first macro definition that contains the<br>
keyword under the cursor. The search starts from<br>
the beginning of the file. If a count is given, the<br>
count'th matching line is jumped to. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#]_CTRL-D" name="]_CTRL-D">]_CTRL-D</a><br>
] <span class="Special">CTRL-D</span> like "[ <span class="Special">CTRL-D</span>", but start at the current cursor<br>
position. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:dj" name=":dj">:dj</a> <a class="Constant" href="tagsrch.html#:djump" name=":djump">:djump</a><br>
:<span class="Special">[range]</span>dj[ump][!] <span class="Special">[count]</span> [/]string[/]<br>
Like "[ <span class="Special">CTRL-D</span>" and "] <span class="Special">CTRL-D</span>", but search in<br>
<span class="Special">[range]</span> lines (default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<span class="Special">CTRL-W</span> <span class="Special">CTRL-D</span> <a class="Constant" href="tagsrch.html#CTRL-W_CTRL-D" name="CTRL-W_CTRL-D">CTRL-W_CTRL-D</a> <a class="Constant" href="tagsrch.html#CTRL-W_d" name="CTRL-W_d">CTRL-W_d</a><br>
<span class="Special">CTRL-W</span> d Open a new window, with the cursor on the first<br>
macro definition line that contains the keyword<br>
under the cursor. The search starts from the<br>
beginning of the file. If a count is given, the<br>
count'th matching line is jumped to. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:dsp" name=":dsp">:dsp</a> <a class="Constant" href="tagsrch.html#:dsplit" name=":dsplit">:dsplit</a><br>
:<span class="Special">[range]</span>dsp[lit][!] <span class="Special">[count]</span> [/]string[/]<br>
Like "<span class="Special">CTRL-W</span> d", but search in <span class="Special">[range]</span> lines<br>
(default: whole file).<br>
See <a class="Identifier" href="tagsrch.html#:search-args">:search-args</a> for [/] and [!]. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:che" name=":che">:che</a> <a class="Constant" href="tagsrch.html#:checkpath" name=":checkpath">:checkpath</a><br>
:che[ckpath] List all the included files that could not be found.<br>
<span class="Special">{not in Vi}</span><br>
<br>
:che[ckpath]! List all the included files. <span class="Special">{not in Vi}</span><br>
<br>
<a class="Constant" href="tagsrch.html#:search-args" name=":search-args">:search-args</a><br>
Common arguments for the commands above:<br>
[!] When included, find matches in lines that are recognized as comments.<br>
When excluded, a match is ignored when the line is recognized as a<br>
comment (according to <a class="Type" href="options.html#'comments'">'comments'</a>), or the match is in a C comment<br>
(after "//" or inside /* */). <span class="Todo">Note</span> that a match may be missed if a<br>
line is recognized as a comment, but the comment ends halfway the line.<br>
And if the line is a comment, but it is not recognized (according to<br>
<a class="Type" href="options.html#'comments'">'comments'</a>) a match may be found in it anyway. Example:<br>
<div class="helpExample"> /* comment<br>
foobar */</div>
A match for "foobar" is found, because this line is not recognized as<br>
a comment (even though syntax highlighting does recognize it).<br>
<span class="Todo">Note</span>: Since a macro definition mostly doesn't look like a comment, the<br>
[!] makes no difference for ":dlist", ":dsearch" and ":djump".<br>
[/] A pattern can be surrounded by '/'. Without '/' only whole words are<br>
matched, using the pattern "\<pattern\>". Only after the second '/' a<br>
next command can be appended with '|'. Example:<br>
<div class="helpExample"> :isearch /string/ | echo "the last one"</div>
For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern<br>
is used as a literal string, not as a search pattern.<br>
<br>
vim:tw=78:ts=8:ft=help:norl:<br>
</div>
</article>
<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>
<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->
</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。