Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trouble trying to understand zsh's completion system
- X-seq: zsh-users 22930
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Filipe Silva <filipe.silva@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: trouble trying to understand zsh's completion system
- Date: Wed, 11 Oct 2017 17:54:43 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=seVxO6 Ch7UBzpPc+ExkfzfQ/k1TJg++/i424KZxm9K0=; b=SkJvVq2BaQTPsjao6LO4hr oHHatj9aeJfC1uqfHBACVr36ZXPZjQCgCFZV0937gPyrCzHaQfa5Vb0tD6UaRHGx +DXq1HgS1kdcLWvDih86PYniBSSNDIE7MqqX3ssqtHPXd8wxNZsvDNWcJl4p6XGn 2l1fV4OhlLNHtLlOS13ZJK7eiKnAjQGRDS80DKdGassf/s4XOgs4IzgOGFqGpNr7 Z37hPAA+o/e4IZ8J3Fr/1FC9AUPnex460l3LGh1EZcCH19ar/ohVDmP4tmkEahDA ERoigs5XOxNTstbz0ZxsjCLvjjd/cHElUv918GfXIDqwyiuP8IUimCtedGB/Xn2A ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=seVxO6 Ch7UBzpPc+ExkfzfQ/k1TJg++/i424KZxm9K0=; b=gR92z973/iGK2WtNcQznHr VULH7hMF8lQjG8r6oCtGyH2n/MsrOqKez6vlramtlx36toj4kmzDyeHQr9mEoJVI CuxymSEWyfUy+cMckmD9shYo/a+nGKj6wr7PKaj86mxdSAERz0+oCCD3stWYa/n6 MUGt315fNjp6wZ5Dp0o8av1ACPayJgg5o4Q7WZndMquruWbaEqa92ba3RR280pbE 5HxInOtWIe/TvjQh0ybmPc/XAH+lsFFDzXKRfET1i2+3zlJnhH/tq0kPVkVcLa7Q 2PIHWebbOjNBYIVTA68K2yoYvoNHwTz+Br7wVSSQcq9PSqGRYqYYNvQPuppKnkiw ==
- In-reply-to: <CAEwkUWM__fzR0wG9RDRXsz+rGXt4d94E_3xo2rkxNVfRnpbvbA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAEwkUWM__fzR0wG9RDRXsz+rGXt4d94E_3xo2rkxNVfRnpbvbA@mail.gmail.com>
Filipe Silva wrote on Wed, 11 Oct 2017 07:37 -0300:
> So I saved this file as _gocomp in a directory:
>
> #compdef go
>
> local -a options
> options=('run:description for run' 'build:description for build')
> _describe 'values' options
>
> after $ fpath=($(readlink -f .) $fpath) and autload -U _gocomp, I try to
> type go [TAB]. zsh greets me with `go _gocomp`.
>
> What am I doing wrong?
You aren't making the link between the command "go" and the autoloadable
function "_gocomp".
You can do that either by running compinit after changing fpath (then
you don't need to run autoload explicitly) or by running 'compdef
_gocomp go' in addition to what you're running.
It completes "_gocomp" because that's the only file in the current
directory. (_files is the default completion)
Minimal example:
zsh -f
autoload compinit
compinit
_foo() { compadd bar }
compdef _foo foo
foo <TAB>
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author