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

zed and bindkey



-----BEGIN PGP SIGNED MESSAGE-----

This patch updates zed's handling of key bindings.  By using bindkey's
new -L option, it can more accurately restore those key bindings that
it changes.  Also, by using the -M option, it can add the appropriate
accept-line key binding for the user's preferred keymap, rather than
blindly using ^X^W.

 -zefram

 *** Functions/zed	1996/08/02 22:38:40	1.1.1.3
 --- Functions/zed	1997/03/21 22:55:26
 ***************
 *** 7,13 ****
   # Completion: use
   # compctl -f -x 'w[1,-f]' -F -- zed
   
 ! local var fun ctrl_W_bind="$(bindkey '^W')"
   # We do not want timeout while we are editing a file
   integer TMOUT=0
   
 --- 7,13 ----
   # Completion: use
   # compctl -f -x 'w[1,-f]' -F -- zed
   
 ! local var fun cleanup
   # We do not want timeout while we are editing a file
   integer TMOUT=0
   
 ***************
 *** 17,38 ****
   [[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1
   
   # catch interrupts
 ! cleanup () {
 !   bindkey "^M" accept-line
 !   bindkey "^X^W" undefined-key
 !   bindkey "^W" "$ctrl_W_bind"
 !   trap - INT
 ! }
 ! 
 ! trap 'cleanup ; return 130' INT
   
   # don't mangle !'s
   setopt localoptions nobanghist
   
   bindkey "^M" self-insert-unmeta
   # Depending on your stty's, you may be able to use ^J as accept-line, else:
 ! bindkey "^X^W" accept-line
 ! bindkey "^W" kill-region
   
   if ((fun)) then
     var="$(functions $1)"
 --- 17,34 ----
   [[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1
   
   # catch interrupts
 ! cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ"
 !     echo "trap - INT EXIT"; trap)"
 ! trap "return 130" INT
 ! trap "$cleanup" EXIT
   
   # don't mangle !'s
   setopt localoptions nobanghist
   
   bindkey "^M" self-insert-unmeta
   # Depending on your stty's, you may be able to use ^J as accept-line, else:
 ! bindkey -M emacs "^X^W" accept-line
 ! bindkey -a "ZZ" accept-line
   
   if ((fun)) then
     var="$(functions $1)"
 ***************
 *** 53,65 ****
     fi
     vared var
     fun=$?
 -   cleanup
     (( fun == 0 )) && eval function "$var"
   else
     [[ -f $1 ]] && var="$(<$1)"
     vared var
     fun=$?
 -   cleanup
     (( fun == 0 )) && print -r -- "$var" >| $1
   fi
   
 --- 49,59 ----

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBMzMUxHD/+HJTpU/hAQFwhgP/eg4DFVHjmiqzQ/N3fsYdv7kHr3ev33fN
GLzgdzhF+BHLBXAl8wgosIQ0kbzC79FUPOK12+sN1vV4CAnn7UNdbaDdqtoQtxtx
NHdAa/zVpxAKjdA8OjvfpYvHLxpSPqukwa182VQKLcKmhIZyq31qHM6cX2pRwC+m
357MHqov1qo=
=OXyk
-----END PGP SIGNATURE-----



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