[m-dev.] mtags & vim

David Overton dmo at cs.mu.OZ.AU
Sat Oct 7 14:16:33 AEDT 2000


Hi,

At the Mercury meeting yesterday, the topic of dealing with non-unique
tags in Vim was brought up.

Vim has some enhanced features over regular vi for handling tag lookups.  Most
of these features rely on extra attributes being added to each tag in the tags
file.  `Mtags' outputs these attributes when invoked with the options
`--ext --vim'.  (When working on the compiler, you can add these options to the
`EXTRA_MTAGSFLAGS' variable in `Mmake.params'.)

For information on using tags in vim, use the command `:help tags'.  The
following is a summary.

Vim classifies tags into two categories: `static' and `global'.  Mtags will mark
tags that occur in the implementation section of a Mercury module as static and
tags that occur in the interface section as global.  (You need to update to the
latest version of `mtags', which I have just committed, for this to work
properly.)

When vim finds multiple matches for a tag lookup, it prioritises them as shown:

	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.

When the user does a tag lookup, the matching tags are ordered using these rules
and the first tag shown.  The command `:tnext' or `:tn' goes to the next
matching tag.  To get a list of all matching tags, use `:tselect' or `:ts'.
This will then allow you to choose which tag you want to jump to.

The `:tselect' list shows the priority of each tag and also the tag's ``kind''.
``Kind'' is an attribute read from the tags file entry.  Mtags produces the
following kinds:
	`pred' for predicate declarations
	`func' for function declarations
	`type' for type definitions
	`cons' for type constructors
	`inst' for inst definitions
	`mode' for mode definitions
	`tc'   for typeclass declarations
	`tci'  for typeclass instance declarations
	`tcm'  for typeclass methods
	`tcim' for typeclass instance methods

Another command you may find useful is `g ctrl-]'.  This is like `ctrl-]' except
that if there are multiple matches, it displays the selection list and asks you
which one you want to jump to.

There are many other useful commands.  See the Vim documentation for more
information.


David
-- 
David Overton      Department of Computer Science & Software Engineering
PhD Student        The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159    http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list