about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Builtins/_bindkey41
-rw-r--r--Doc/Zsh/mod_zle.yo2
3 files changed, 41 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index b627323b2..4eba11b0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-12  Oliver Kiddle  <opk@u.genie.co.uk>
+
+	* 10701: Completion/Builtins/_bindkey, Doc/Zsh/mod_zle.yo:
+	use _arguments for bindkey completion and fix typo in docs
+
 2000-04-12  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
 	* 10699: Src/parse.c, Src/zsh.h: compare mapped zwc files using
diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey
index 8eddeb2a8..6f6677b59 100644
--- a/Completion/Builtins/_bindkey
+++ b/Completion/Builtins/_bindkey
@@ -1,7 +1,36 @@
-#defcomp bindkey
+#compdef bindkey
 
-if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then
-  complist -s '$(bindkey -l)'
-else
-  complist -b
-fi
+# Normally, this completes names of zle widgets, whether the builtin ones
+# or ones defined by the user.  Note that a - allows a wildcard before it,
+# so h-b-s-b will complete to history-beginning-search-backward.  You
+# can alter this by removing the -M ... from the second compadd.
+#
+# Where appropriate, will complete keymaps instead of widgets.
+
+local state expl line
+
+_arguments -C -s \
+  '(-v -a -M -l -D -A -N)-e[select emacs keymap and bind it to main]' \
+  '(-e -a -M -l -D -A -N)-v[select viins keymap and bind it to main]' \
+  '(-e -v -M -l -D -A -N)-a[select vicmd keymap]' \
+  '(-e -v -a -l -D -A -N)-M[specify keymap to select]:keymap:->keymap' \
+  '(-e -v -a -M -D -A -N -m -r -s -R *)-l[list existing keymap names]' \
+  '(-e -v -a -d -A -N -m -r -s -R *)-L[output in form of bindkey commands]' \
+  '(-e -v -a -l -D -A -N -m -r -s -R *)-d[delete existing keymaps and reset to default state]' \
+  '(-e -v -a -M -l -d -A -N -m -r -s -R *)-D[delete named keymaps]:*:keymap:->keymap' \
+  '(-e -v -a -M -l -L -d -D -N -m -r -s -R *)-A[create alias to keymap]:old-keymap:->keymap:new-keymap:->keymap' \
+  '(-e -v -a -M -l -L -d -D -A -m -r -s -R *)-N[create new keymap]:new-keymap:->keymap:old-keymap to copy:->keymap' \
+  '(-l -L -d -D -A -N -r -s -r -R *)-m[add builtin meta-key bindings to selected keymape]' \
+  '(-l -L -d -D -A -N -m -s *)-r[unbind specified in-strings]:*:in-string' \
+  '(-l -L -d -D -A -N -m -r *)-s[bind each in-string to each out-string]:*:key string' \
+  '(-e -v -a -M -l -L -d -D -A -N -m)-R[interpret in-strings as ranges]' \
+  '(-l -L -d -A -N -m -r -s)*::widgets:->widget'
+
+case $state in
+  keymap)
+    _wanted -C -M keymaps expl keymap compadd - "$keymaps[@]"
+  ;;
+  widget)
+    _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}"
+  ;;
+esac
diff --git a/Doc/Zsh/mod_zle.yo b/Doc/Zsh/mod_zle.yo
index a677ad0b1..d301b4de3 100644
--- a/Doc/Zsh/mod_zle.yo
+++ b/Doc/Zsh/mod_zle.yo
@@ -72,7 +72,7 @@ be empty.
 )
 enditem()
 
-To use a newly created keymamp, it should be linked to tt(main).  Hence
+To use a newly created keymap, it should be linked to tt(main).  Hence
 the sequence of commands to create and use a new keymap `tt(mymap)'
 initialized from the tt(emacs) keymap (which remains unchanged) is: