zsh-users
 help / color / mirror / code / Atom feed
* contect sensitive remapping <enter>
@ 2004-05-25  9:02 Eric Smith
  2004-06-05 19:10 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Smith @ 2004-05-25  9:02 UTC (permalink / raw)
  To: Zsh Users

I would like to do a context sensitive remapping of <enter>.
I guess this would be along the lines of a completion function
with a specification for the command context:
#compdef commanda commandb commandn

Then I would like <enter> to be interpreted as
<tab><enter>

Thanks for the help :)

-- 
Eric Smith


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: contect sensitive remapping <enter>
  2004-05-25  9:02 contect sensitive remapping <enter> Eric Smith
@ 2004-06-05 19:10 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2004-06-05 19:10 UTC (permalink / raw)
  To: Zsh Users

[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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-05 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-25  9:02 contect sensitive remapping <enter> Eric Smith
2004-06-05 19:10 ` Bart Schaefer

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).