zsh-users
 help / color / mirror / code / Atom feed
* Loading completion function from custom fpath
@ 2013-07-30 23:18 Felipe Sateler
  2013-07-31  7:01 ` Frank Terbeck
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Sateler @ 2013-07-30 23:18 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Loading completion function from custom fpath
  2013-07-30 23:18 Loading completion function from custom fpath Felipe Sateler
@ 2013-07-31  7:01 ` Frank Terbeck
  2013-07-31 13:59   ` Felipe Sateler
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2013-07-31  7:01 UTC (permalink / raw)
  To: Felipe Sateler; +Cc: zsh-users

Hi Felipe,

Felipe Sateler wrote:
> fpath=('~/.zsh/functions' $fpath)

This doesn't work.

If you put the "~" into quotes (single or double, it doesn't matter) zsh
won't perform tilde-expansion. And thus, you'll end up with a string in
$fpath that starts with '~/' literally, like you pasted:

[...]
> ~/.zsh/functions

And I bet that's not a valid directory on you system. :)

Either leave the quotes off or use double quotes along with $HOME. The
following should be equivalent:

  fpath=(~/.zsh/functions $fpath)
  fpath=("$HOME/.zsh/functions" $fpath)

Either of them should work.

Regards, Frank


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Loading completion function from custom fpath
  2013-07-31  7:01 ` Frank Terbeck
@ 2013-07-31 13:59   ` Felipe Sateler
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Sateler @ 2013-07-31 13:59 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: zsh-users

On Wed, Jul 31, 2013 at 3:01 AM, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Hi Felipe,

Hi Frank,

>
> Felipe Sateler wrote:
>> fpath=('~/.zsh/functions' $fpath)
>
> This doesn't work.
>
> If you put the "~" into quotes (single or double, it doesn't matter) zsh
> won't perform tilde-expansion. And thus, you'll end up with a string in
> $fpath that starts with '~/' literally, like you pasted:
>
> [...]
>> ~/.zsh/functions
>
> And I bet that's not a valid directory on you system. :)
>
> Either leave the quotes off or use double quotes along with $HOME. The
> following should be equivalent:
>
>   fpath=(~/.zsh/functions $fpath)
>   fpath=("$HOME/.zsh/functions" $fpath)
>
> Either of them should work.

Now I feel really stupid. I thought I tried the unquoted path before
(indeed I ended up with the quoted path trying different versions).
Indeed unquoting it works!

Thanks for your help!


-- 

Saludos,
Felipe Sateler


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-31 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 23:18 Loading completion function from custom fpath Felipe Sateler
2013-07-31  7:01 ` Frank Terbeck
2013-07-31 13:59   ` Felipe Sateler

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).