Last active
April 17, 2017 20:59
-
-
Save Orangenhain/c9ac6ea47f187589813b9887c300a897 to your computer and use it in GitHub Desktop.
zsh completion - partial coloring issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - start a clean shell with `zsh -f` | |
# - `source` this file | |
# - `a -<tab>` WILL show color | |
# - `a --<tab>` will NOT show color | |
# - `b -<tab>` will NOT show color | |
# - `c <tab>` will NOT show color | |
# if you uncomment the line after "YYY", ALL examples WILL show color | |
# first example shows up as expected (only option is red, rest is normal) | |
# but for the others, the *complete* line will be colored | |
# if you uncomment the line after "ZZZ", ALL examples WILL show color (complete lines, as expected) | |
zmodload zsh/complist | |
autoload -U compinit && compinit | |
zstyle ':completion:*' list-separator "XX" | |
zstyle ':completion:*:default' list-colors '=XX*=31' | |
# YYY | |
# zstyle ':completion:*:default' list-colors '=^(XX*)=31' | |
# ZZZ | |
# zstyle ':completion:*:default' list-colors '=*=31' | |
_a () { | |
_arguments \ | |
'(--first -f)'{--first,-f}'[first should be red]' \ | |
'--second[second should be red]' | |
} | |
compdef _a a | |
_b () { | |
_arguments \ | |
'--second[second should be red]' \ | |
'-t[more red arguments]' | |
} | |
compdef _b b | |
_c () { | |
local -a targets | |
targets=(1:"this should be red" 2:"this as well") | |
_describe -t targets 'stuff' targets | |
} | |
compdef _c c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wanted to to colour the per-match description differently from the actual match. But for some reason I can't get this to work in different cases.