zsh-users
 help / color / mirror / code / Atom feed
* Configuring Keys F1 to F12
@ 2011-02-10 14:42 zzapper
  2011-02-10 15:34 ` Anthony Charles
  2011-02-10 18:00 ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: zzapper @ 2011-02-10 14:42 UTC (permalink / raw)
  To: zsh-users

Hi
I've been trying to bindkey anything at all to the function keys without 
luck.

(zsh, cygwin, dos window)

I can bind the control keys etc. Ideally I want to assign text to the 
function keys

eg press f7 and generate say perl at the prompt

How many wrong trees am I barking up?



-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-10 14:42 Configuring Keys F1 to F12 zzapper
@ 2011-02-10 15:34 ` Anthony Charles
  2011-02-10 17:23   ` zzapper
  2011-02-10 17:39   ` zzapper
  2011-02-10 18:00 ` Bart Schaefer
  1 sibling, 2 replies; 9+ messages in thread
From: Anthony Charles @ 2011-02-10 15:34 UTC (permalink / raw)
  To: zsh-users

Hi,

 bindkey -s '^v<F1>' 'ls -l'

Is this what you want ?

On Thu, Feb 10, 2011 at 02:42:03PM +0000, zzapper wrote:
> Hi
> I've been trying to bindkey anything at all to the function keys without 
> luck.
> 
> (zsh, cygwin, dos window)
> 
> I can bind the control keys etc. Ideally I want to assign text to the 
> function keys
> 
> eg press f7 and generate say perl at the prompt
> 
> How many wrong trees am I barking up?
> 
> 
> 

-- 
Anthony CHARLES


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-10 15:34 ` Anthony Charles
@ 2011-02-10 17:23   ` zzapper
  2011-02-10 17:39   ` zzapper
  1 sibling, 0 replies; 9+ messages in thread
From: zzapper @ 2011-02-10 17:23 UTC (permalink / raw)
  To: zsh-users

Anthony Charles wrote in news:20110210153454.GC17063@layslair.ath.cx:

> Hi,
> 
>  bindkey -s '^v<F1>' 'ls -l'
> 
> Is this what you want ?

>> 
>> eg press f7 and generate say perl at the prompt
>> 
Anthony
Looks good but doesnt work for me


-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-10 15:34 ` Anthony Charles
  2011-02-10 17:23   ` zzapper
@ 2011-02-10 17:39   ` zzapper
  2011-02-11  9:57     ` Anthony Charles
  1 sibling, 1 reply; 9+ messages in thread
From: zzapper @ 2011-02-10 17:39 UTC (permalink / raw)
  To: zsh-users

Anthony Charles wrote in news:20110210153454.GC17063@layslair.ath.cx:

> Hi,
> 
>  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



-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-10 14:42 Configuring Keys F1 to F12 zzapper
  2011-02-10 15:34 ` Anthony Charles
@ 2011-02-10 18:00 ` Bart Schaefer
  1 sibling, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2011-02-10 18:00 UTC (permalink / raw)
  To: zsh-users

On Feb 10,  2:42pm, zzapper wrote:
}
} I've been trying to bindkey anything at all to the function keys without 
} luck.
} 
} (zsh, cygwin, dos window)

I'm not sure (never use cygwin) but I don't believe the function
keys are interpeted/converted by the dos window into any input being
delivered to the shell underneath. If you don't see *anything* in the
window when you press a function key -- particularly if you first press
ctrl-v and then follow that with the function key -- then ZLE has no way
to detect that the key has been pressed in the first place, and you'll
have to first look elsewhere for a way to cause the function keys to
send a string to the shell.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-10 17:39   ` zzapper
@ 2011-02-11  9:57     ` Anthony Charles
  2011-02-11 15:02       ` zzapper
  0 siblings, 1 reply; 9+ messages in thread
From: Anthony Charles @ 2011-02-11  9:57 UTC (permalink / raw)
  To: zsh-users

On Thu, Feb 10, 2011 at 05:39:54PM +0000, zzapper wrote:
> Anthony Charles wrote in news:20110210153454.GC17063@layslair.ath.cx:
> 
> > Hi,
> > 
> >  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 CHARLES


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-11  9:57     ` Anthony Charles
@ 2011-02-11 15:02       ` zzapper
  2011-02-11 16:27         ` Dan Nelson
  0 siblings, 1 reply; 9+ messages in thread
From: zzapper @ 2011-02-11 15:02 UTC (permalink / raw)
  To: zsh-users

Anthony Charles wrote in news:20110211095705.GD17063@layslair.ath.cx:

> On Thu, Feb 10, 2011 at 05:39:54PM +0000, zzapper wrote:
>> Anthony Charles wrote in news:20110210153454.GC17063@layslair.ath.cx:
>> 
>> > Hi,
>> > 
>> >  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


-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-11 15:02       ` zzapper
@ 2011-02-11 16:27         ` Dan Nelson
  2011-02-11 16:53           ` zzapper
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Nelson @ 2011-02-11 16:27 UTC (permalink / raw)
  To: zzapper; +Cc: zsh-users

In the last episode (Feb 11), zzapper said:
> Anthony Charles wrote in news:20110211095705.GD17063@layslair.ath.cx:
> > On Thu, Feb 10, 2011 at 05:39:54PM +0000, zzapper wrote:
> >> Anthony Charles wrote in news:20110210153454.GC17063@layslair.ath.cx:
> >> >  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@allantgroup.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring Keys F1 to F12
  2011-02-11 16:27         ` Dan Nelson
@ 2011-02-11 16:53           ` zzapper
  0 siblings, 0 replies; 9+ messages in thread
From: zzapper @ 2011-02-11 16:53 UTC (permalink / raw)
  To: zsh-users

Dan Nelson wrote in news:20110211162725.GG66849@dan.emsphone.com:

> In the last episode (Feb 11), zzapper said:

> 
> # 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~".
> 
Thanks Dan

This looks useful a reference

http://zshwiki.org/home/zle/bindkeys

-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-02-11 16:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 14:42 Configuring Keys F1 to F12 zzapper
2011-02-10 15:34 ` Anthony Charles
2011-02-10 17:23   ` zzapper
2011-02-10 17:39   ` zzapper
2011-02-11  9:57     ` Anthony Charles
2011-02-11 15:02       ` zzapper
2011-02-11 16:27         ` Dan Nelson
2011-02-11 16:53           ` zzapper
2011-02-10 18:00 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).