Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My zsh does git completion, but I did not configure this myself. How can I figure out where these settings are coming from?

share|improve this question

migrated from stackoverflow.com Aug 7 '11 at 20:39

This question came from our site for professional and enthusiast programmers.

up vote 11 down vote accepted

zsh comes with its own completion library which includes completions for Git commands. Once you enable zsh’s completion, these bundle completions will be available.

You usually enable and configure zsh completion by running compinstall (i.e. autoload -U compinstall && compinstall). It will modify your .zshrc to include autoload -Uz compinit and compinit so that completion is initialized for each instance of zsh. compinit automatically loads completions from zsh’s fpath directories (see the “Autoloaded files” section of the zshcompsys manpage).

For example, my system has two versions of zsh installed:

  • /bin/zsh gets Git completions from
    /usr/share/zsh/4.3.9/functions/_git and
  • /opt/local/bin/zsh gets Git completions from
    /opt/local/share/zsh/4.3.12/functions/_git.

The directories of these _git files are in the respective shell’s fpath (which also includes site-functions directory that is next to the version directory).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .