Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: the function to show a digit argument while it is being typed
- X-seq: zsh-users 14542
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: the function to show a digit argument while it is being typed
- Date: Tue, 10 Nov 2009 20:47:48 -0800
- In-reply-to: <237967ef0911101822g5bfcf4fao25fc33ba0a2e8604@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <10081257897632@xxxxxxxxxxxxxxxxxxx> <237967ef0911101822g5bfcf4fao25fc33ba0a2e8604@xxxxxxxxxxxxxx>
On Nov 11, 3:22am, Mikael Magnusson wrote:
}
} I have a similar function, it doesn't work well for negative arguments
} though:
}
} function _digit_argument () {
} zle -M "$NUMERIC$KEYS[-1]"
} zle .digit-argument
} }
Hmm, that suggests yet another possible improvement to my function. I
assumed $NUMERIC was updated too late to use it in PREDISPLAY, but it
is updated in time to be used in place of my __digit_arg global.
function digit-argument-show {
if [[ $LASTWIDGET == neg-argument ]]
then PREDISPLAY="(arg: $((NUMERIC*$KEYS[-1]))) "
else PREDISPLAY="(arg: $NUMERIC$KEYS[-1]) "
fi
zle -R
zle .digit-argument
zle read-command
[[ $REPLY != digit-argument ]] && PREDISPLAY=""
zle -U $KEYS
}
With this, you don't need the neg-argument-show function at all, and
assignments to PREDISPLAY can be replaced with zle -M if you like.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author