Tag Stacking

Tag stacking is described earlier in the section Tag Stacks. Besides moving back and forth among the tags you search for, you can choose among multiple matching tags. You can also do tag selection and window splitting with one command. The Vim ex mode commands for working with tags are provided in Table 14-1.

Table 14-1. Vim tag commands
CommandFunction
ta[g][!] [tagstring]

Edit the file containing tagstring as defined in the tags file. The ! forces Vim to switch to the new file if the current buffer has been modified but not saved. The file may or may not be written out, depending on the setting of the autowrite option.

[count]ta[g][!]

Jump to the count’th newer entry in the tag stack.

[count]po[p][!]

Pop a cursor position off the stack, restoring the cursor to its previous position. If supplied, go to the count’th older entry.

tags

Display the contents of the tag stack.

ts[elect][!] [tagstring]

List the tags that match tagstring, using the information in the tags file(s). If no tagstring is given, the last tag name from the tag stack is used.

sts[elect][!] [tagstring]

Like :tselect, but splits the window for the selected tag.

[count]tn[ext][!]

Jump to the count’th next matching tag (default is 1).

[count]tp[revious][!]

Jump to the count’th previous matching tag (default is 1).

[count]tN[ext][!]
[count]tr[ewind][!]

Jump to the first matching tag. With count, jump to the count’th matching tag.

tl[ast][!]

Jump to the last matching tag.

Normally, Vim shows you which matching tag out of how many ...

Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.