Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using _describe for completions.
- X-seq: zsh-users 22936
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Nicholas Wiles <nhwiles@xxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: Using _describe for completions.
- Date: Thu, 12 Oct 2017 17:42:09 +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=fhLTbv a694mAQnAVx86wdiP+rSjiQpez9tUTLnirVm8=; b=bK49yvmfUOj7sC4sRnJeHv RY3BJlQvg4aYssJbM48mVnt3G0x7x06xpVHSN1ziS77nOaxZBJEE/TXB3VwpraxV ezXWRplfOM3o0XlHD88ziC6AfObxLQlklEOu981uyzz00rxMIV32/eD5KzUjKyOx LT36AoMP755ierZIjyMpONouQse8gRsJh7fT6Cepx4d5NJJ93f6kj8pOjvPLkvxV HYjpmkM6IagjVEopaupAhDMtXzEdnG+QyIT7WtmW3WQEA/9cCVnHQm6qnoakkApt VsezTBpw5rinxdLkgf7X4H5FB7zwJ6RF2ZS3hLBNBqwsXF1pfgSO42abJYo68WVg ==
- 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=fhLTbv a694mAQnAVx86wdiP+rSjiQpez9tUTLnirVm8=; b=MPiQMAwaywlp7OAWyQkvbx kRN+SOO0RcBWr23N3qjvniT6xzvj2JlK9GOPyGkJMIpCzv4Ql4iliFQ5s2pGk0iC daMYTYk68DxJhw38DWG6xvxNdR2+MvIcgtlUQO6YGG/4p0t7/oFXv1L+FreUQzTd KdOUAaIVjeenfdFzuyAFRbaDIaVATh0U1hq3Z5aM2ZSVoWj1rxRagif8Kb5VTqhH +TpThC7mnZQfaAzoqz6HlUb8tgO2NofGGHJN1WT2cXnPJGRCn5iefWCSv6LvM8Mc bC7w28mcaCFEIoPOYF/LP6r25DcY+MIkj/xYTL25lRMV2TKkTOQ6rRkKvZHvNPGw ==
- In-reply-to: <5CD230C2-0103-456B-A567-F63FE6CECFE1@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: <5CD230C2-0103-456B-A567-F63FE6CECFE1@gmail.com>
Nicholas Wiles wrote on Thu, 12 Oct 2017 09:19 -0700:
> Hello fellow users, fist time poster. I apologize if this is not the right place.
>
> On zsh 5.2 I am trying to write a completion function using the _describe builtin.
>
> __foo_complete_func() {
> list=(foo:'description for foo’ bar:'description for bar')
Please don't use Unicode quotes in code samples, that makes harder to try them.
> _describe '’ list && _ret=0
What's this _ret thing? Your completion function is overwriting a
global variable named "_ret".
> }
>
> compdef __foo_complete_func foo
>
> When autocompleting just “foo ” I get the expected:
>
> bar -- description for bar
> foo -- description for foo
>
> However when tab completing "foo b" I get no matches shown. I don’t understand why this is. I would expect to get the completion "foo bar”
>
> Any ideas?
Works for me in 'zsh -f' + 'autoload compinit; compinit' + (pasting your
code) + 'foo b<TAB>'.
I would make the first argument to _describe non-empty just in case
there's a null argument elision somewhere, but for clarity, it works for
me as posted.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author