Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion, sorting of options



From: Mikael Magnusson <mikachu@xxxxxxxxx>
Date: Sat, 4 Nov 2023 16:49:25 +0100

> On 11/4/23, Thomas Lauer <thomas.lauer@xxxxxxxxxx> wrote:
> > So I'm writing my first completion file (gory thing, just the right
> > thing for a rainy Sat afternoon). The completion file itself is more or
> > less working, but I've run into trouble with the options display after
> > "-<TAB>".
> >
> > Basically what I want to achieve is that the options are listed in
> > precisely the order given in the completion file (there are many options
> > and some are much more probable to be used than others, so I want these
> > at the top (I know that further typing will limit the shown completions
> > but not all people using this will be up to that... a simple up/down
> > might work better for some)).
> 
> If you give -V foo it will create an unsorted group, but it is a bit
> unconventional to do this for sorting regular options by usage. You
> could also consider adding the common options with a -J common and the
> other ones with a -J rare, or something to that effect.

Thanks, Mikael. Alas, I am not going to pretend that I understand what
you've written.

As I wrote
> first completion file
and I threw together (w/ some help from big G) something that works (ie
it lists the options on -<TAB>, completes two directories and adds a
final command as to what to do). The options are the problem as there
are many and for the reasons given I'd like to list them in a specific
order.

Anyway, my naive interpretation of the "sort false" bit in the zstyle is
that sort is false, ie no sorting is done ("sort nosort" seems equally
clear but doesn't not sort).

Apparently I could try to do something about that but I've not really
understood what. Could you please elaborate?

Again thanks  T




Messages sorted by: Reverse Date, Date, Thread, Author