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

Re: contect sensitive remapping <enter>



[I'm just back from 3 weeks in Japan, and catching up on mail sort of in
reverse order.]

On Tue, 25 May 2004, Eric Smith wrote:

> I would like to do a context sensitive remapping of <enter>.

Unfortunately there's no such thing as context-sensitive key rebinding.
There are certain "contexts" that change to new keymaps, but those are
effectively recursive invocations of the editor, not contexts in the sense
used by the completion system.

So the best you can do is to redefine the accept-line widget to always
test for this situation, invoke completion if need be, and then fall
through to "zle .accept-line".

> I guess this would be along the lines of a completion function

You'd need an ordinary widget for the accept-line replacement, plus a
completion widget to handle the context testing and possible completion.
Call the completion widget from the accept-line replacement with the
"zle" command.

I'd start by getting ordinary completion to work as you want for the
commands in question before attempting anything with accept-line.



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