Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ZSH's way to bind function to a key in a script?
- X-seq: zsh-users 15857
- From: Wendell Hom <wendell_hom@xxxxxxxxx>
- To: Jérémie Roquet <arkanosis@xxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: ZSH's way to bind function to a key in a script?
- Date: Wed, 9 Mar 2011 16:22:38 -0800 (PST)
- Cc: nix@xxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1299716558; bh=b5h68FHazsV+5tF8yVGYTzfMcZQZPZZI8yMOtTAx4F4=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=KRo2c/qz68z4m0Jdi+YEeABXFiUHjJ+UHjz7MCXG98n1BycKL+cnv0KMNTWW3o5FdqqBLc5Yqev9a0nYpEMZmcFeiFuuQbgPEPBX1Iwf8l4z5+CznrSJS2CdRYbctcZ8LoUy651JX+W1dXuQACkuG50ynPd1+gJzTfXU9/jqaGI=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=Ygfs2a4Mk4hNRorikCXSPCZCLlzdqkgnP7ZBUkIGtfx1/zfFFa9jLvUUPn34mCTilBxXD+SXPEqoS9dGwftcXzX4teQQO8BimgKIttzt6hMe6jz/mc8qJKZlhHlJpiz+AloZxbaVWf5bgoUM7CV16mtt9aGehOblXtUZOlu0XsI=;
- In-reply-to: <AANLkTi=O8arik7Au7fN5320H4zHHJftkA+WJ47RVDTo_@mail.gmail.com>
- 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: <dc64f3246d1cac04e3dfa582a9e1ad16.squirrel@gameframe.net> <AANLkTikuzpSBtnCS0fWxQFDerbPX=pMqnR2JS15QTr25@mail.gmail.com> <34287570baba3024c8cffea8be3da248.squirrel@gameframe.net> <AANLkTi=O8arik7Au7fN5320H4zHHJftkA+WJ47RVDTo_@mail.gmail.com>
When using "read -k key"
I am matching against normal keys with
if [ $key = '?' ]
simple control characters like tabs with
if (( #key == ##\t ))
Ctrl + key sequences with
(( #key == ##\C-u ))
But how do I match against Alt + key sequences?
Thanks,
Wendell
________________________________
From: Jérémie Roquet <arkanosis@xxxxxxxxx>
To: zsh-users@xxxxxxx
Cc: nix@xxxxxxxxxxxxxxxx
Sent: Wed, March 9, 2011 6:35:48 AM
Subject: Re: ZSH's way to bind function to a key in a script?
2011/3/9 <nix@xxxxxxxxxxxxxxxx>:
> Can't get it working in a script. Tried both vt100/xterm terminals but nada.
> My purpose is this:
>
> while [ : ] ; do
>
> ...
>
> A user press the space button and he will see the script progress ....
>
> done
Then it's unrelated to bindkey ;-)
Try this:
while [ : ]; do
read -ks a
[[ $a = ' ' ]] && foo
done
Have a look at “man zshbuiltins” for more about the “read” builtin.
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author