diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-06 09:04:32 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-06 09:04:32 +0000 |
commit | ead1fff7dbd518efdd7799030ea773cd0d5eee31 (patch) | |
tree | 86432efcfb0d5b12b22cdbefd54f64797572fbed /Completion/X | |
parent | e2409e0649ac61e938624ba349988f58f873bf54 (diff) | |
download | zsh-ead1fff7dbd518efdd7799030ea773cd0d5eee31.tar.gz zsh-ead1fff7dbd518efdd7799030ea773cd0d5eee31.tar.xz zsh-ead1fff7dbd518efdd7799030ea773cd0d5eee31.zip |
zsh-workers/7650
Diffstat (limited to 'Completion/X')
-rw-r--r-- | Completion/X/_x_color | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Completion/X/_x_color b/Completion/X/_x_color index 346142eea..405347ef9 100644 --- a/Completion/X/_x_color +++ b/Completion/X/_x_color @@ -1,5 +1,13 @@ #autoload +# This tries to automatically find the rgb.txt color database. If this +# in an unusual place on your system or you want a personal database, +# you can use the configuration key: +# +# colors_path +# Path to a file containing the names of colors you want to +# complete. In the form of a X11 rgb.txt file. + local expl if (( ! $+_color_cache )); then @@ -7,16 +15,18 @@ if (( ! $+_color_cache )); then # Cache of color names doesn't exist yet, create it. - file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) - - if (( $#file )); then - _color_cache=( "${(@)${(@f)$(< $file[1])}[2,-1]##* }" ) + if [[ -n "$compconfig[colors_path]" ]]; then + _color_cache=( "${(@)${(@f)$(< $compconfig[colors_path])}[2,-1]##* }" ) else + file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) - # Stupid default value. - - _color_cache=(white black gray red blue green) + (( $#file )) && + _color_cache=( "${(@)${(@f)$(< $file[1])}[2,-1]##* }" ) fi + + # Stupid default value. + + (( $#_color_cache )) || _color_cache=(white black gray red blue green) fi _description expl 'color specification' |