From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22772 invoked by alias); 15 Dec 2014 07:30:09 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19538 Received: (qmail 17238 invoked from network); 15 Dec 2014 07:29:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=7irWVsrNpfAjTI+Mz3s5+EK27U9ioZzdYrcsmbaSepI=; b=Xay98Pwv/lCPptAONdQ89sdgKsskCPRDkwMdTHMkN9WnQbHdjecsTF9qj5Bqq1o0ef B/lPP84937bAH08I2mEfZBrrV12NBxeWm81WtAe/RBSYFf/LdadEakdn13H+q0PAN/8o iETpOoba30tJSgW/SgQ8Vyq9iejuYUQ6Hz7UvtNHcRzF9hsY152KxZio196YMrDLW63r WBzUjDZEc+tcv8o3W4su1VfxMcRb/DrUM6hJ48StYYsWrbynMUeH4ovC1Db6MNF5P29J BJFk7gHkIFns87pPRz4B58AbwTBkJpUh4przIy40B4PCPt94k3LgCol2+IEcM5s1XKK4 4Gbg== MIME-Version: 1.0 X-Received: by 10.194.185.243 with SMTP id ff19mr16165107wjc.126.1418626781097; Sun, 14 Dec 2014 22:59:41 -0800 (PST) Sender: rocky.bernstein@gmail.com In-Reply-To: <141214185002.ZM24092@torch.brasslantern.com> References: <141214185002.ZM24092@torch.brasslantern.com> Date: Mon, 15 Dec 2014 01:59:41 -0500 X-Google-Sender-Auth: v_r7KT7P3ML9hlAV9fI8zI0rq2I Message-ID: Subject: Re: How to get compadd to not sort words? From: Rocky Bernstein To: Bart Schaefer Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=047d7bb03f125b32e5050a3bc9dd --047d7bb03f125b32e5050a3bc9dd Content-Type: text/plain; charset=UTF-8 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 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. > --047d7bb03f125b32e5050a3bc9dd--