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

Re: Problem with motion commands defined using match-word-by-style used with vi-delete



On Apr 24,  9:39pm, Nikolai Weibull wrote:
} Subject: Re: Problem with motion commands defined using match-word-by-styl
}
} On 4/24/06, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
} >
} > Here's a simple internal widget that reads a key sequence and sets
} > REPLY to the command bound to it (so you can run zle on that).

[Hmm, somehow I managed to miss PWS's message.  I wonder if it was a
victim of Verizon's latest overeager spam-blocking fiasco.]

This is actually quite useful as it resets KEYS as well as sets REPLY,
so with this you can do

    describe-key-briefly() {
      zle -R "Describe key briefly: "
      zle read-command
      zle -M "${(V)KEYS} is $REPLY"
    }

That doesn't help with describe-binding, which needs to map in the
other direction, but it's a start.

Incidentally I just noticed that within a widget called by using
execute-named-command, the value of $KEYS is carriage return.  I'm not
sure what I expected it to be, but that wasn't it.

} There's still no easy way to execute the command in the right
} environment so that WIDGET is set to the read command that we want to
} execute.

It really *should* be the case that

    local -h WIDGET

creates a new parameter named WIDGET that is neither read-only nor
special, but apparently the usual parameter rules don't apply to the
ZLE specials.



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