diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2003-08-22 16:30:28 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2003-08-22 16:30:28 +0000 |
commit | 2270746356368eb20676bbfb26c82c2a06e694ec (patch) | |
tree | 90c91d1100d1145c9d7e6b16cd786b94f1f92f3f /Completion/X | |
parent | 2fe227ff13556508ed844e8996c8c3bc8401a4a3 (diff) | |
download | zsh-2270746356368eb20676bbfb26c82c2a06e694ec.tar.gz zsh-2270746356368eb20676bbfb26c82c2a06e694ec.tar.xz zsh-2270746356368eb20676bbfb26c82c2a06e694ec.zip |
tidy up of many completions (updates, fixes, improvements and plain aesthetics)
Diffstat (limited to 'Completion/X')
-rw-r--r-- | Completion/X/Type/_x_color | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Completion/X/Type/_x_color b/Completion/X/Type/_x_color new file mode 100644 index 000000000..960eae6d3 --- /dev/null +++ b/Completion/X/Type/_x_color @@ -0,0 +1,34 @@ +#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 + local file + + # Cache of color names doesn't exist yet, create it. + + zstyle -s ":completion:${curcontext}:colors" path file + if [[ -n "$file" ]]; then + _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) + else + file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) + + (( $#file )) && + _color_cache=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" ) + fi + + # Stupid default value. + + (( $#_color_cache )) || _color_cache=(white black gray red blue green) +fi + +_wanted colors expl 'color specification' compadd "$@" -M \ + 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _color_cache |