# # Provide arrays for accept-line and magic-space handlers # # Copyright © 1994–2017 martin f. krafft # Released under the terms of the Artistic Licence 2.0 # # Source repository: http://git.madduck.net/v/etc/zsh.git # function _widget_functions_handler() { emulate -L zsh local fn for fn in ${(P)${:-"${WIDGET//-/_}_functions"}}; do eval $fn \"\$@\"; done [[ $WIDGET != zle-* ]] || return zle .${WIDGET} "$@" } # define arrays like $accept_line_functions so we can stack functions to be # called for these widgets typeset -l widget for widget in accept_line magic_space zle_line_init; do typeset -ga ${widget}_functions zle -N ${widget//_/-} _widget_functions_handler done # vim:ft=zsh