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

Re: completion, sorting of options

From: Thomas Lauer <thomas.lauer@xxxxxxxxxx>
Date: Sat, 04 Nov 2023 15:42:25 +0000

> 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)).
> So I created a zstyle like this:
> zstyle ':completion:*:*:mycmd:*:*' sort false
> And this *does* change the order but not as expected. Rather, the
> completion now first displays all single-letter options (-X), followed
> by the -X=value options. Those two sublists are indeed shown in the same
> order as in the completion file but in the completion the -X options
> *follow* the -X=value options. So there's still something going on...
> but I can't see what. (I've also tried "sort nosort"... no change).
> Probably the zstyle still needs some more massaging but I haven't a clue
> where to look... but one of the z-gurus might know?!
> Thanks for helping out  T

Apparently there's no obvious solution to the zstyle "sort false/nosort"
thing. How about creating yet another value for this style:

zstyle ':completion:*:*:mycmd:*:*' sort nosort_and_i_really_mean_nosort


Cheers  T

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