about summary refs log tree commit diff
path: root/Completion/Unix/Type/_dict_words
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Type/_dict_words')
-rw-r--r--Completion/Unix/Type/_dict_words17
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_dict_words b/Completion/Unix/Type/_dict_words
new file mode 100644
index 000000000..44448e8f8
--- /dev/null
+++ b/Completion/Unix/Type/_dict_words
@@ -0,0 +1,17 @@
+#autoload
+
+local dict dictresult dictwords j expl
+
+[[ -z $words[CURRENT] ]] && return 1
+
+dictresults=(${${(f)${"$(dict -m $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