Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: use _arguments in _bindkey



Attached is a patch to _bindkey to to make use of _arguments.
I have also fixed a typo in to docs for bindkey. I'll attempt
to commit this to cvs myself.

Oliver


Index: Completion/Builtins/_bindkey
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_bindkey,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 _bindkey
--- Completion/Builtins/_bindkey	2000/03/23 04:19:27	1.1.1.11
+++ Completion/Builtins/_bindkey	2000/04/12 14:37:35
@@ -7,10 +7,30 @@
 #
 # Where appropriate, will complete keymaps instead of widgets.
 
-local expl
+local state expl line
 
-if [[ "$words[2]" = -*[DAN]* || "$words[CURRENT-1]" = -*M ]]; then
-  _wanted -C -M keymaps expl keymap compadd - "$keymaps[@]"
-else
-  _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}"
-fi
+_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
Index: Doc/Zsh/mod_zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_zle.yo,v
retrieving revision 1.2
diff -u -r1.2 mod_zle.yo
--- Doc/Zsh/mod_zle.yo	2000/04/01 20:43:44	1.2
+++ Doc/Zsh/mod_zle.yo	2000/04/12 14:37:35
@@ -72,7 +72,7 @@
 )
 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:
 



Messages sorted by: Reverse Date, Date, Thread, Author