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

Re: Color in completions

On Jan 31,  4:38pm, Sebastian Gniazdowski wrote:
} Subject: Re: Color in completions
} On 29 January 2016 at 23:45, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > You can get color in completion listings with the complist module,
} > see "man zshmodules" or "info zsh 'The zsh/complist Module'".
} Managed to do this. Had to:
} 1. Figure out to use _wanted instead of only compadd

Actually I think it's _description that you need rather than _wanted,
but calling _wanted gets you there via _all_labels ...

Or you could just assign ZLS_COLORS yourself instead of using a style,
I think, but calling _wanted is preferable.

} 2. Figure out what pattern to give to zstyle:
} zstyle ':completion:*:zplugin:*:argument-rest' list-colors
} '=(#b)(*)/(*)==1;35=1;33'
} When I display $curcontext within _zplugin (after adding -C to
} _arguments), it shows: :complete:zplugin:argument-rest. I wonder why
} do I need the additional ":*:" before "argument-rest" ? Or even the
} first one.

I don't know why you need the second one.  You shouldn't.  What you
should need is a :* at the end, for the "tag" slot (see below).

You need the first one because the string ":completion:" with colons
at both ends is prefixed to $curcontext for style lookups.

 The context string always consists of a fixed set of fields, separated
 by colons and with a leading colon before the first.  Fields which are
 not yet known are left empty, but the surrounding colons appear anyway.
 The fields are always in the order

So in your zstyle above --

    Lookup context      Your pattern
    --------------      ------------
    completion          completion
    COMMAND             zplugin
    ARGUMENT            *
    TAG                 argument-rest

I would have expected "argument-rest" to match the ARGUMENT position
rather than the TAG position, so:

  zstyle ':completion:*:zplugin:argument-rest:*' list-colors \

What does ctl+x h (_complete_help) show if you use that instead of tab?

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