Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
the function to show a digit argument while it is being typed
- X-seq: zsh-users 14539
- From: Dmitry Bolshakov <bdimych@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: the function to show a digit argument while it is being typed
- Date: Wed, 11 Nov 2009 03:00:32 +0300
- 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
hi
in bash a digit argument is showed when it is being typed
i have writed small function which do the same
#####
function digit-argument-show-while-entering {
arg="${KEYS[2]}"
if [[ $arg == - ]]
then
zle .neg-argument
else
zle .digit-argument
fi
while true
do
PREDISPLAY="(arg: $arg) "
zle -R
read -k k1
if [[ $k1 == $'\C-g' ]]
then
NUMERIC=1
break
elif [[ $k1 != $'\e' ]]
then
zle -U $k1
break
fi
read -k k2
if [[ $k2 == <0-9> ]]
then
arg=$arg$k2
NUMERIC=$arg
else
zle -U "$k1$k2"
break
fi
done
PREDISPLAY=""
}
zle -N digit-argument digit-argument-show-while-entering
zle -N neg-argument digit-argument-show-while-entering
#####
it is not well tested but seems to be working
--
with best regards
Dmitry Bolshakov
Messages sorted by:
Reverse Date,
Date,
Thread,
Author