Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How Zsh bindkey -s work

On Sun, May 14, 2023 at 6:09 PM <budikusasi@xxxxxxxxx> wrote:
> How Zsh bindkey -s mechanism as it cannot normally work for content of $
> ( ... ) i.e. interprocess syntax ?

This sounds more like a zsh-users question than -workers, but:

I'm not sure what you mean here.  I'm going guess that you're
expecting to be able to do something like

bindkey -s $'\e[15~' '$(<somefile)'

and thereby have the contents of somefile inserted into the command
line (or some similar thing) when you press F5.

This isn't what bindkey -s is meant to do.  It's a keyboard shortcut
mechanism, to replace one set of keystrokes with another.  The
replacement set is then also interpreted as if typed, etc.

What you (seem to, I may be guessing wrong) want is accomplished with
the widget mechanism.

function insert_somefile {
zle -N insert_somefile
bindkey $'\e[15~' insert_somefile

If this doesn't resemble what you're after, you'll have to ask a more
specific question.

Messages sorted by: Reverse Date, Date, Thread, Author