From: Rocky Bernstein <rockyb@rubyforge.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: How to get compadd to not sort words?
Date: Mon, 15 Dec 2014 01:59:41 -0500 [thread overview]
Message-ID: <CANCp2gZs72uK0Hr-ypx4wKoyP-AB5LyuSDbr0L0b-tGtVD+Ggg@mail.gmail.com> (raw)
In-Reply-To: <141214185002.ZM24092@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]
Many thanks.
This does the trick. I'm happy with getting this in the order given without
special formatting of negative numbers.
On Sun, Dec 14, 2014 at 9:50 PM, Bart Schaefer <schaefer@brasslantern.com>
wrote:
> On Dec 14, 8:35pm, Rocky Bernstein wrote:
> }
> } For example, if I enter
> }
> } compadd -- 1 2 -1 -2 -3 0
> }
> } The completions come out in the order:
> }
> } -3 -2 -1 0 1 2
> }
> } But what I really want is the order I gave.
>
> "compadd" is actually one of the better-documented bits of the completion
> system. Some of the "support builtins" aren't documented at all.
>
> } How can I tell compadd not to sort the completions?
>
> You need to put them in a named unsorted group.
>
> compadd -V numbers 1 2 -1 -2 -3 0
>
> Group names end up being referenced via the "tag" slot in the six-part
> completion context string, e.g., with the compadd above you might use
>
> zstyle ':completion:*:*:*:*:numbers' list-colors '=-*=7'
>
> to show negative numbers in reverse video. However, to make that work
> you have to initialize the style mechanism by calling _description:
>
> local expl
> _description -V numbers expl 'Some Numbers'
> compadd "$expl[@]" - 1 2 -1 -2 -3 0
>
> The _description function does all the style processing and fills in
> the $expl variable with the corresponding compadd options. The example
> in the zsh manual isn't as clear as it could be because it uses
>
> _description files expl file
> compadd "$expl[@]" - "$files[@]"
>
> and although expl in the _description call maps to $expl in the compadd
> call, the two uses of "files" are unrelated.
>
next prev parent reply other threads:[~2014-12-15 7:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 1:35 Rocky Bernstein
2014-12-15 2:50 ` Bart Schaefer
2014-12-15 6:59 ` Rocky Bernstein [this message]
2014-12-15 9:09 ` Bart Schaefer
2014-12-15 16:16 ` Rocky Bernstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANCp2gZs72uK0Hr-ypx4wKoyP-AB5LyuSDbr0L0b-tGtVD+Ggg@mail.gmail.com \
--to=rockyb@rubyforge.org \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).