Home Explore Blog CI



neovim

3rd chunk of `runtime/doc/usr_29.txt`
85f9e0fa89a40836e6b9343f34b0ecb242f8421f5909c2f20000000100000fa0
 further matches.  If there are many, you can select which
one to jump to: >

	:tselect tagname

Vim will present you with a list of choices:

	  # pri kind tag	       file ~
	  1 F	f    mch_init	       os_amiga.c ~
		       mch_init() ~
	  2 F	f    mch_init	       os_mac.c ~
		       mch_init() ~
	  3 F	f    mch_init	       os_msdos.c ~
		       mch_init(void) ~
	  4 F	f    mch_init	       os_riscos.c ~
		       mch_init() ~
	Enter nr of choice (<CR> to abort):  ~

You can now enter the number (in the first column) of the match that you would
like to jump to.  The information in the other columns give you a good idea of
where the match is defined.

To move between the matching tags, these commands can be used:

	:tfirst			go to first match
	:[count]tprevious	go to [count] previous match
	:[count]tnext		go to [count] next match
	:tlast			go to last match

If [count] is omitted then one is used.


GUESSING TAG NAMES

Command line completion is a good way to avoid typing a long tag name.  Just
type the first bit and press <Tab>: >

	:tag write_<Tab>

You will get the first match.  If it's not the one you want, press <Tab> until
you find the right one.
   Sometimes you only know part of the name of a function.  Or you have many
tags that start with the same string, but end differently.  Then you can tell
Vim to use a pattern to find the tag.
   Suppose you want to jump to a tag that contains "block".  First type
this: >

	:tag /block

Now use command line completion: press <Tab>.  Vim will find all tags that
contain "block" and use the first match.
   The "/" before a tag name tells Vim that what follows is not a literal tag
name, but a pattern.  You can use all the items for search patterns here.  For
example, suppose you want to select a tag that starts with "write_": >

	:tselect /^write_

The "^" specifies that the tag starts with "write_".  Otherwise it would also
be found halfway in a tag name.  Similarly "$" at the end makes sure the
pattern matches until the end of a tag.


A TAGS BROWSER

Since CTRL-] takes you to the definition of the identifier under the cursor,
you can use a list of identifier names as a table of contents.  Here is an
example.
   First create a list of identifiers (this requires Universal or Exuberant
ctags): >

	ctags --c-types=f -f functions *.c

Now start Vim without a file, and edit this file in Vim, in a vertically split
window: >

	vim
	:vsplit functions

The window contains a list of all the functions.  There is some more stuff,
but you can ignore that.  Do ":setlocal ts=99" to clean it up a bit.
   In this window, define a mapping: >

	:nnoremap <buffer> <CR> 0ye<C-W>w:tag <C-R>"<CR>

Move the cursor to the line that contains the function you want to go to.
Now press <Enter>.  Vim will go to the other window and jump to the selected
function.


RELATED ITEMS

To make case in tag names be ignored, you can set 'ignorecase' while leaving
'tagcase' as "followic", or set 'tagcase' to "ignore".

The 'tagbsearch' option tells if the tags file is sorted or not.  The default
is to assume a sorted tags file, which makes a tags search a lot faster, but
doesn't work if the tags file isn't sorted.

The 'taglength' option can be used to tell Vim the number of significant
characters in a tag.

==============================================================================
*29.2*	The preview window

When you edit code that contains a function call, you need to use the correct
arguments.  To know what values to pass you can look at how the function is
defined.  The tags mechanism works very well for this.  Preferably the
definition is displayed in another window.  For this the preview window can be
used.
   To open a preview window to display the function "write_char": >

	:ptag write_char

Vim will open a window, and jumps to the tag "write_char".  Then it takes you
back to the original position.  Thus you can continue typing without the need
to use a CTRL-W command.
   If the name of a function appears in the

Title: Navigating Multiple Tag Matches, Guessing Tag Names, and Using a Tags Browser
Summary
This section details how to handle multiple tag matches using commands like `:tselect`, `:tfirst`, `:tprevious`, `:tnext`, and `:tlast`. It also explains how to guess tag names using command line completion with `<Tab>` and pattern matching with `/`. Additionally, it describes how to create a tags browser by generating a list of identifiers and mapping `<Enter>` to jump to the selected function in a split window. Finally, it touches on related options like 'ignorecase', 'tagcase', 'tagbsearch', and 'taglength', and introduces the preview window for displaying function definitions using `:ptag`.