Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Loading completion function from custom fpath



Hi all,

I'm having some issues with zsh that I hoped you could give some help.
I'm trying to add custom completion functions (I'm trying to create a
new one). However, as I do not want to use root, I want the new
completion functions to live within my $HOME. Google tells me that all
that I needed to do is create a directory, add it to fpath in my
zshrc, and be done with it. However, this doesn't work.

My zshrc says:

=====
fpath=('~/.zsh/functions' $fpath)

zstyle :compinstall filename '/home/felipe/.zshrc'

autoload -Uz compinit
compinit
=====

I have deposited a completion for the gbp command in
~/.zsh/functions/_gbp, yet the completion system doesn't pick it up (I
am removing .zcompdump and then restarting zsh to test).

This output is interesting:
% _gbp
zsh: command not found: _gbp
% autoload -U _gbp
% _gbp
zsh: _gbp: function definition file not found

Interestingly enough, if I do:

% sudo ln -s ~/.zsh/functions/_gbp /usr/share/zsh/vendor-completions/_gbp

The completion is picked up by the system, and the _gbp function now exists:

% _gbp
_arguments:comparguments:312: can only be called from completion function
_arguments:comparguments:312: can only be called from completion function

My fpath is:

% echo $fpath
~/.zsh/functions /usr/local/share/zsh/site-functions
/usr/share/zsh/vendor-functions /usr/share/zsh/vendor-completions
/usr/share/zsh/functions/Calendar /usr/share/zsh/functions/Chpwd
/usr/share/zsh/functions/Completion
/usr/share/zsh/functions/Completion/AIX
/usr/share/zsh/functions/Completion/BSD
/usr/share/zsh/functions/Completion/Base
/usr/share/zsh/functions/Completion/Cygwin
/usr/share/zsh/functions/Completion/Darwin
/usr/share/zsh/functions/Completion/Debian
/usr/share/zsh/functions/Completion/Linux
/usr/share/zsh/functions/Completion/Mandriva
/usr/share/zsh/functions/Completion/Redhat
/usr/share/zsh/functions/Completion/Solaris
/usr/share/zsh/functions/Completion/Unix
/usr/share/zsh/functions/Completion/X
/usr/share/zsh/functions/Completion/Zsh
/usr/share/zsh/functions/Completion/openSUSE
/usr/share/zsh/functions/Exceptions /usr/share/zsh/functions/MIME
/usr/share/zsh/functions/Misc /usr/share/zsh/functions/Newuser
/usr/share/zsh/functions/Prompts /usr/share/zsh/functions/TCP
/usr/share/zsh/functions/VCS_Info
/usr/share/zsh/functions/VCS_Info/Backends
/usr/share/zsh/functions/Zftp /usr/share/zsh/functions/Zle


My zsh is 5.0.2 on amd64, debian linux.

So, the question is: why is the completion function not loaded when on
my own defined fpath dir? How can I make zsh load it?

I will of course provide any extra info necessary. Please CC me on
replies, as I'm not subscribed.


-- 

Saludos,
Felipe Sateler



Messages sorted by: Reverse Date, Date, Thread, Author