Specifically, I'd like to arrange for all completion lists (under the :completion:* context) to be preceded and followed by a fixed string (say "ABC" for the moment) on its own line.
I have tried a variety of approaches, and I'm able to get the preceding line but not the following one. The best approaches are
-
Use the array comppostfunc in _main_complete. Including a function that uses _message -r to print out the line. But comppostfun is executed at the end of _main_complete but apparently before the list is created, giving the string at the beginning not the end.
-
Create new completers — a clone of _complete that returns 1 and a completer that just does _message. The idea being that the _message completer comes last.
This works to a point but again the string comes at the beginning of the completion list. -
Adapt 1 or 2 by playing with the tag-order style to put messages at the end. This does not work.
-
Create a variant of the _complete completer that does its normal action (_normal in one case) and ends with a _message. Again this does both but always puts the message first. Playing with tag-order does not change this.
I feel I'm missing something. For instance, is there a way to specify a completer style in which the output of several completers is concatenated? Why doesn't doing several actions within a completer produce the completion list in order? How to get tag-order style to put the _message output at the end?
Best Answer
The
tag-order
style does not change the order of the output. What you need to use is thegroup-order
style. In addition, your beginning and end messages will need to have differentgroup-name
s. See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Standard-Styles for more info.