zsh-users
 help / color / mirror / code / Atom feed
From: Dan Nelson <dnelson@allantgroup.com>
To: zzapper <david@tvis.co.uk>
Cc: zsh-users@zsh.org
Subject: Re: Configuring Keys F1 to F12
Date: Fri, 11 Feb 2011 10:27:26 -0600	[thread overview]
Message-ID: <20110211162725.GG66849@dan.emsphone.com> (raw)
In-Reply-To: <Xns9E8998F98F3E5zzappergmailcom@80.91.229.10>

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


  reply	other threads:[~2011-02-11 16:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 14:42 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 [this message]
2011-02-11 16:53           ` zzapper
2011-02-10 18:00 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110211162725.GG66849@dan.emsphone.com \
    --to=dnelson@allantgroup.com \
    --cc=david@tvis.co.uk \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).