Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Multi-level keybinding?
- X-seq: zsh-users 13605
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users <zsh-users@xxxxxxxxxx>
- Subject: Re: Multi-level keybinding?
- Date: Sat, 20 Dec 2008 18:41:36 -0800
- In-reply-to: <2d460de70812201550k27ec90a4i1f8370d861fb282d@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2d460de70812200740j50e87b2dn3744a119d0ec49ee@xxxxxxxxxxxxxx> <081220105556.ZM23966@xxxxxxxxxxxxxxxxxxxxxx> <2d460de70812201550k27ec90a4i1f8370d861fb282d@xxxxxxxxxxxxxx>
On Dec 21, 12:50am, Richard Hartmann wrote:
}
} > Reading this I'm not sure what output you want from "binding_overview".
}
} Ideally, I would want the keybinding for ^X to be executed each and
} every time a keybinding starting with ^X is called. But ZLE should
} still listen for another key.
What's the connection between having the same keystroke execute more
than one widget, and having a keystroke that displays an overview of
the bindings? Do you really want the explanation printed every time
the keystroke executes?
} I.e. both the widget for ^X and ^Xn are executed when I press ^Xn
} a single time.
Well, the way you do that is with a wrapper widget that uses the name
to which it is bound to decide what other function to run. Something
like this:
ctrl-x () {
BUFFER+=" Hi there, I'm ${(V)KEYS}."
}
zle -N ctrl-x
bindkey ^X ctrl-x
ctrl-x-prefix () {
zle ctrl-x
$WIDGET
}
do-something () {
BUFFER+=" Pleased to meet you, I'm $WIDGET."
}
zle -N do-something ctrl-x-prefix
bindkey ^Xn do-something
do-anything () {
CURSOR=0
LBUFFER="Move over for $WIDGET "
}
zle -N do-anything ctrl-x-prefix
bindkey ^Xa do-anything
Messages sorted by:
Reverse Date,
Date,
Thread,
Author