Enhanced Tags and Tag Stacks

Vim and most of the other vi clones provide enhanced tagging facilities. You can stack locations on a tag stack, and with Exuberant ctags, tag more items than just functions.

Exuberant ctags

The “Exuberant ctags” program was written by Darren Hiebert (home page: http://ctags.sourceforge.net/). As of this writing, the current version is 5.8.

This enhanced tags file format has three tab-separated fields: the tag name (typically an identifier), the source file containing the tag, and the location of the identifier. Extended attributes are placed after a separating ;". Each attribute is separated from the next by a tab character and consists of two colon-separated subfields. The first subfield is a keyword describing the attribute; the second is the actual value.

Extended ctags keywords

Keyword

Meaning

arity

For functions

class

For C++ member functions and variables

enum

For values in an enum data type

file

For static tags, i.e., local to the file

function

For local tags

kind

The value is a single letter that indicates the lexical type of the tag

scope

Intended mostly for C++ class member functions

struct

For fields in a struct

If the field doesn’t contain a colon, it’s assumed to be of type kind.

Within the value part of each attribute, the backslash, tab, carriage return, and newline characters should be encoded as \\, \t, \r, and \n, respectively.

Solaris vi Tag Stacking

vi provides ex and vi commands for managing the tag stack.

Tag commands—ex

Command ...

Get vi and Vim Editors Pocket Reference, 2nd 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.