From 47c440aa2a141b1af60c2df192ff257b902dd177 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 7 Apr 2014 09:58:30 +0100 Subject: 32527: zcalc-auto-insert key binding for use in zcalc --- Functions/Zle/zcalc-auto-insert | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Functions/Zle/zcalc-auto-insert (limited to 'Functions/Zle') diff --git a/Functions/Zle/zcalc-auto-insert b/Functions/Zle/zcalc-auto-insert new file mode 100644 index 000000000..c9a5c8867 --- /dev/null +++ b/Functions/Zle/zcalc-auto-insert @@ -0,0 +1,8 @@ +# Bind to a binary operator keystroke for use with zcalc + +if [[ -n $ZCALC_ACTIVE ]]; then + if [[ $CURSOR -eq 0 || $LBUFFER[-1] = "(" ]]; then + LBUFFER+=${ZCALC_AUTO_INSERT_PREFIX:-"ans "} + fi +fi +zle .self-insert -- cgit 1.4.1