Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Configuring Keys F1 to F12
- X-seq: zsh-users 15797
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: zzapper <david@xxxxxxxxxx>
- Subject: Re: Configuring Keys F1 to F12
- Date: Fri, 11 Feb 2011 10:27:26 -0600
- Cc: zsh-users@xxxxxxx
- In-reply-to: <Xns9E8998F98F3E5zzappergmailcom@80.91.229.10>
- 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: <Xns9E8895882A0D5zzappergmailcom@80.91.229.10> <20110210153454.GC17063@layslair.ath.cx> <Xns9E88B3AEAD3E0zzappergmailcom@80.91.229.10> <20110211095705.GD17063@layslair.ath.cx> <Xns9E8998F98F3E5zzappergmailcom@80.91.229.10>
In the last episode (Feb 11), zzapper said:
> Anthony Charles wrote in news:20110211095705.GD17063@xxxxxxxxxxxxxxx:
> > On Thu, Feb 10, 2011 at 05:39:54PM +0000, zzapper wrote:
> >> Anthony Charles wrote in news:20110210153454.GC17063@xxxxxxxxxxxxxxx:
> >> > bindkey -s '^v<F7>' 'ls -l'
> >>
> >> Anthony thanks works a treat:-
> >> what I failed to realise is that you have to actually type
> >>
> >> (Control-v F7)
> >> which on my system displays as:-
> >>
> >> bindkey -s "^[[18~" 'ls -l'
> >>
> >> Yhis is going to be hyper useful : thanks
> >>
> > You're welcome, sorry for being unclear.
> >
> Anthony my fault not yours; I've just realized where I was BLOCKING!
>
> I was trying to enter the bindkey straight into my zsh config file whereas
> i should have been generating the key sequence on the command line
>
> so
> bindkey -s "^[[18~" 'ls -l'
>
> goes into ~/.zshrc
You could use something like this:
# usage: bindtc <cap> <default> <string>
bindtc ()
{
local keyval=${termcap[$1]:-$2}
[[ -n $keyval ]] bindkey -s $keyval $3
}
I use something similar to bind commands to things like pgup and pgdn, whose
escape sequences vary across terminals. With it, you can run:
bindtc k7 "^[[18~" 'ls -l'
which will use the termcap entry for F7, or if it's missing, will fall back
to "^[[18~".
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author