From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 286 invoked by alias); 15 Dec 2014 02:50:02 -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: 19535 Received: (qmail 16366 invoked from network); 15 Dec 2014 02:50:00 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=b6gFOWC0 c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=A92cGCtB03wA:10 a=Hf1Vo-QhaWvnYs7O6MEA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141214185002.ZM24092@torch.brasslantern.com> Date: Sun, 14 Dec 2014 18:50:02 -0800 In-reply-to: Comments: In reply to Rocky Bernstein "How to get compadd to not sort words?" (Dec 14, 8:35pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: How to get compadd to not sort words? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.