From HaskellWiki
Revision as of 23:19, 10 September 2009 by GerardMilmeister (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Z Shell Completion for GHC and Hugs

The Z Shell is a powerful shell with extensive completion support.


The _ghc script supports completion for ghc and ghc-pkg. The completion features include the following:

  • all options with a description for each option
  • directories
  • package names
  • system libraries (-l option)
  • ghc-pkg commands

The _hugs script provides completion for options.


Put the _ghc and _hugs scripts in a path that zsh searches during autoloading, for example /usr/share/zsh/functions or a private directory (which must be added to the FPATH environment variable).

Completion must be enabled by adding to .zshrc the following lines:

   autoload -U compinit

Completion functionality can be configured using styles. These are set with the zstyle function.

Here are some examples:

   zstyle ':completion:*' completer _complete _match _approximate
   zstyle ':completion:*' use-cache on
   zstyle ':completion:*:approximate:*' max-errors 1 numeric

See the zsh documenation for details on configuring the completion system.