about summary refs log tree commit diff
path: root/Completion/Unix/Type/_dict_words
blob: 770319036533f05c8e0c64bf6f23dd681a119ecf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#autoload

local dict dictresult dictwords j expl

[[ -z $words[CURRENT] ]] && return 1

dictresults=(${${(f)${"$(dict -m -s prefix $words[CURRENT])":gs/    
  / /}}:#[0-9]*matches found})

for j in ${dictresults}
do
  dict=${j%%:*}
  dictwords=(${(z)j#*:})

  _wanted $dict expl "words from $dict" \
       compadd -M 'm:{a-zA-Z}={A-Za-z} r:|=*' -a "$@" - dictwords
done