FPATH in Zsh – Managing Functions and Site-Functions

zsh

I noticed I have the following line near the beginning of my .zshrc file:

export FPATH=/usr/share/zsh/site-functions:/usr/share/zsh/4.2.6/functions:$FPATH  

I can't remember if I typed this myself or if this line was automatically generated by zsh-newuser-install.

Is it assumed that the user types those paths in FPATH in a startup file? What's the difference between functions and site-functions?

Best Answer

The 4.2.6/functions directory contains functions shipped with zsh 4.2.6. The site-functions directory contains functions that are added by third-party packages or by the local administrator; under Linux the local administrator would usually use a site-functions directory under /usr/local.

Normally these directories would be in the default fpath setting built into the zsh executable, it's strange that you would need to add them. I don't see any code in zsh-newuser-install that would add these lines; it looks like something your site administrator or you wrote.

Note that the FPATH string variable is tied to the fpath array variable, so you could write

fpath=(/some/extra/directory $fpath)
Related Question