Personal tools


From HaskellWiki

Revision as of 12:50, 15 May 2010 by Bartholomew (Talk | contribs)

Jump to: navigation, search


1 Introduction

"Tags" are a listing of code objects in a group of files, together with their precise location, often used by text editors to quickly jump around in a program. ctags (for C) was the first tag-generation program.

There are currently a number of different ways to generate tags with Haskell.

This page should be used to collect information on tag-generation for Haskell, including information on how to use tags with common editors and what benefits they can give you.

2 Haskell tag generators

Chris Ryder and Simon Thompson give a tag generator's source in a paper

Norman Ramsey and Kathleen Fisher's partial hasktags implementation using the GHC API is in darcs. There's also a GHC trac task relating to it.

echo ":ctags" | ghci -v0 Main.hs

echo ":etags" | ghci -v0 Main.hs

utils/hasktags from GHC.

gasbag (which understands all options recognised by hasktags).

3 Usage

The tags file generated in ctags format can be used in (amongst others) vim, BBEdit and NEdit. The one in etags format can be used in at least Emacs. Note that the default names for the file in ctags format and the file in etags format are 'tags' and 'TAGS' respectively. These names clash on case-insensitive filesystems, such as Mac OS's HFS and HFS+ in the default configuration.

In vi, one jumps to a tag using either

:tag <tag-to-jump-to>

or by using control-] with the cursor on the tag to jump to. Using control-T returns to the previous position.

4 Random other bits


Using tags in Vim

:help tags

insert-mode tag completion (ctrl-x ctrl-])

:help tags-file-format

:help cursorhold-example

NEdit documentation for using tags

Chapter 14 of the BBEdit manual