From: Bart Schaefer <schaefer@brasslantern.com>
To: <zsh-users@zsh.org>
Subject: Re: How to get compadd to not sort words?
Date: Mon, 15 Dec 2014 01:09:17 -0800 [thread overview]
Message-ID: <141215010917.ZM24252@torch.brasslantern.com> (raw)
In-Reply-To: <CANCp2gZs72uK0Hr-ypx4wKoyP-AB5LyuSDbr0L0b-tGtVD+Ggg@mail.gmail.com>
On Dec 15, 1:59am, Rocky Bernstein wrote:
}
} Many thanks.
}
} This does the trick. I'm happy with getting this in the order given without
} special formatting of negative numbers.
You're welcome. The special formatting was just an example I picked to
show how you'd associate styles with the completion results.
In fact, just to flesh out the example a little ...
If you want ^Xh (_complete_help) to be able to generate useful help for
the context, you need to call _tags to initialize that part of the
system, and then you should use the _requested wrapper to make the call
to _description and compadd. So you might do
_unsorted() {
local expl ret=1
_tags numbers letters
while _tags; do
if _requested -V numbers expl 'Some Numbers' compadd 1 2 -1 -2 3 0
then ret=0
fi
if _requested -V letters expl 'Some Letters' compadd A B Z X C M
then ret=0
fi
done
return ret
}
This is obviously a lot more interesting if the completions are more than
a single character/digit. For sorted groups, use -J instead of -V. (No,
there isn't a mnemonic for why -J and -V got used here; it was because
they were single letters not already being used for something else.)
next prev parent reply other threads:[~2014-12-15 9:08 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
2014-12-15 9:09 ` Bart Schaefer [this message]
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=141215010917.ZM24252@torch.brasslantern.com \
--to=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).