ZSH completion functions broken

Solution 1:

As per a clue in installation problems with colors, compinit and git plugin #4757, it seems that verifying the "$FPATH variable content" contains the correct path for where you installed the functions should help resolve the problem.

Furthermore, copying the zsh contents over to a location such as the root or a path already defined in $FPath may help resolve this problem as well.

The first thing to do is verify your FPATH variable content: echo $FPATH. In a normal situation return something like that: /home/charmander/.oh-my-zsh/plugins/git:/home/charmander/.oh-my-zsh/functions:/home/charmander/.oh-my-zsh/completions:/home/charmander/.oh-my-zsh/plugins/python:/home/charmander/.oh-my-zsh/plugins/pip:/home/charmander/.oh-my-zsh/plugins/git:/home/charmander/.oh-my-zsh/functions:/home/charmander/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/5.0.2/functions.

In my case it returned: /opt/intel/composer_xe_2011_sp1.7.256/mkl/include. When I try to remove .oh-my-zsh and run only zsh returned this: /usr/share/zsh/5.0.2/scripts/newuser:6: zsh-newuser-install: function definition file not found. Search in web I found this bug report: zsh: Many function definitions are missing zsh-newuser-install, compinit, etc that say it could have a variable overwrite made by Intel compiler :/

So a workaround to this problem could be insert the following lines to your .bash_profile, if you can not run this command chsh -s $(which zsh).

FPATH=/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/python:/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/pip:/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/git:/home/modelagem/beatriz.fonseca/.oh-my-zsh/functions:/home/modelagem/beatriz.fonseca/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/5.0.2/functions

export FPATH

source

Additionally as per a clue from colors: function definition file not found #4607, it appears that others have solved this problem by adding $HOME/usr/share/zsh/'version of zsh'/functions to solve this as installing zsh as $HOME/usr can cause this issue.


Further Reading

   FPATH  The search path for function definitions.  The directories in this  path  are  searched
                 for  a  file  with the same name as the function or command when a function with the -u
                 attribute is referenced and when a command is not found.  If an  executable  file  with
                 the name of that command is found, then it is read and executed in the current environ-ment. environment.
                 ment.  Unlike PATH, the current directory must be represented explicitly by  .   rather
                 than by adjacent : characters or a beginning or ending :.

source


9.1 Autoloading Functions

A function can be marked as undefined using the autoload builtin (or ‘functions -u’ or ‘typeset -fu’). Such a function has no body. When the function is first executed, the shell searches for its definition using the elements of the fpath variable.

source

Solution 2:

I just wanted to add a short note that this error can also happen if you have two separate versions of ZSH installed. Make sure that you don't have anything in your FPATH that would be incompatible with the version of ZSH that you're using for your actual login shell.