about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_dict_words17
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f5bc65dbf..7bb4c9151 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-02-08  Clint Adams  <clint@zsh.org>
+
+       * Matt Zimmerman: 16590: Completion/Unix/Type/_dict_words:
+       use a prefix match instead of a "fuzzy-exact" match.
+
 2002-02-07  Clint Adams  <clint@zsh.org>
 
         * unposted: Functions/Prompts/.distfiles,
diff --git a/Completion/Unix/Type/_dict_words b/Completion/Unix/Type/_dict_words
new file mode 100644
index 000000000..770319036
--- /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 -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