zsh-users
 help / color / mirror / code / Atom feed
* Re: menu selection and enter key
@ 2003-03-14 20:45 Virginia Mann
  2003-03-17 10:31 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Virginia Mann @ 2003-03-14 20:45 UTC (permalink / raw)
  To: zsh-users


When I use the line (thanks Oliver and Andrey!)

bindkey -M menuselect '^M' .accept-line

It causes my enter key to do what I want it to do (execute immediately 
instead of making me hit <enter> twice), so I put it in my .zshrc.

But when I first start up a new zsh, and .zshrc is sourced the first time, 
this line fails with the error: "no such keymap `menuselect'".

If I do some menu selection and then rerun this .zshrc, the bindkey works 
and sets the desired behavior.

It appears that I need to load something before I execute this line. Or 
maybe there's a way to instruct zsh to accept it because the needed bits 
will be loaded later (like a C++ forward declaration).

I have no idea. I don't want to accidentally switch my default keymap to 
menuselect or load more than necessary or cause something to reload 
everytime I source my .zshrc by forcing a manual load or whatever else may 
go wrong. What would be the best approach for use in my .zshrc to get this 
line to work sensibly?

Thanks.



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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

* Re: menu selection and enter key
  2003-03-14 20:45 menu selection and enter key Virginia Mann
@ 2003-03-17 10:31 ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2003-03-17 10:31 UTC (permalink / raw)
  To: zsh-users

"Virginia Mann" wrote:
> When I use the line (thanks Oliver and Andrey!)
> 
> bindkey -M menuselect '^M' .accept-line
> 
> It causes my enter key to do what I want it to do (execute immediately 
> instead of making me hit <enter> twice), so I put it in my .zshrc.
> 
> But when I first start up a new zsh, and .zshrc is sourced the first time, 
> this line fails with the error: "no such keymap `menuselect'".

If you are using the new completion system with the styles set for menu
selection, move this line after the call to compinit, since the
completion system will load the libraries for you.

Otherwise, put
  zmodload -i zsh/complist
just before it.  The -i stops it complaining if you re-source .zshrc.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* RE: menu selection and enter key
  2003-03-10 13:55 ` Oliver Kiddle
@ 2003-03-11  7:19   ` Borzenkov Andrey
  0 siblings, 0 replies; 5+ messages in thread
From: Borzenkov Andrey @ 2003-03-11  7:19 UTC (permalink / raw)
  To: 'Oliver Kiddle', 'Virginia Mann'; +Cc: zsh-users


> "Virginia Mann" wrote:
> > I'm configuring zsh for the first time and trying to understand the
> > features.
> >
> > I find menu completion very useful, and I like seeing the list of
> candidates
> > below it. <tab><tab><tab> yes, that's the one I want<enter>, and it
> > executes.
> >
> > Then I found menu *selection*, which let me see where I was as I tabbed
> thru
> > the candidates by highlighting where I am in the list, which is very
> > convenient. Unfortunately, when I reach the one I want and hit <enter>,
> it
> > no longer executes. Now it just inserts a space and sits there waiting
> for
> > me to enter more. I have to hit enter again to make it execute.
> 

But you may just as well continue editing current line without executing it.


> accept-line in menu selection is redefined to do that. If I've
> understood what you want it to do correctly, you can do:
> 
> double-accept() {
>   zle accept-line && zle accept-line
> }
> zle -N double-accept
> bindkey -M menuselect '^M' double-accept
> 

Would not simple

bindkey -M menuselect '^M' .accept-line

be easier? 
 
-andrey


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

* Re: menu selection and enter key
  2003-03-09  6:41 Virginia Mann
@ 2003-03-10 13:55 ` Oliver Kiddle
  2003-03-11  7:19   ` Borzenkov Andrey
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2003-03-10 13:55 UTC (permalink / raw)
  To: Virginia Mann; +Cc: zsh-users

"Virginia Mann" wrote:
> I'm configuring zsh for the first time and trying to understand the 
> features.
> 
> I find menu completion very useful, and I like seeing the list of candidates 
> below it. <tab><tab><tab> yes, that's the one I want<enter>, and it 
> executes.
> 
> Then I found menu *selection*, which let me see where I was as I tabbed thru 
> the candidates by highlighting where I am in the list, which is very 
> convenient. Unfortunately, when I reach the one I want and hit <enter>, it 
> no longer executes. Now it just inserts a space and sits there waiting for 
> me to enter more. I have to hit enter again to make it execute.

accept-line in menu selection is redefined to do that. If I've
understood what you want it to do correctly, you can do:

double-accept() {            
  zle accept-line && zle accept-line
}
zle -N double-accept
bindkey -M menuselect '^M' double-accept

Does that help?

Oliver


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

* menu selection and enter key
@ 2003-03-09  6:41 Virginia Mann
  2003-03-10 13:55 ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Virginia Mann @ 2003-03-09  6:41 UTC (permalink / raw)
  To: zsh-users

I'm configuring zsh for the first time and trying to understand the 
features.

I find menu completion very useful, and I like seeing the list of candidates 
below it. <tab><tab><tab> yes, that's the one I want<enter>, and it 
executes.

Then I found menu *selection*, which let me see where I was as I tabbed thru 
the candidates by highlighting where I am in the list, which is very 
convenient. Unfortunately, when I reach the one I want and hit <enter>, it 
no longer executes. Now it just inserts a space and sits there waiting for 
me to enter more. I have to hit enter again to make it execute.

I like being able to see where I am on the list more than tabbing thru it 
blindly, and I like being able to navigate particularly long lists by using 
the arrow keys (very nice), but how do I get it to execute when I hit 
<enter> the first time, just the way it does when I'm tabbing thru the list 
without highlighting? If I want to enter two parameters -- which is the 
minority of cases -- I should be able to just hit the spacebar and start 
tabbing again the way I can when the "selection" highlighting is turned off, 
I would think.

Can menu completion with selection turned on be made to execute on the first 
tab like it can with selection turned off?

Thanks.




_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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

end of thread, other threads:[~2003-03-17 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14 20:45 menu selection and enter key Virginia Mann
2003-03-17 10:31 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09  6:41 Virginia Mann
2003-03-10 13:55 ` Oliver Kiddle
2003-03-11  7:19   ` Borzenkov Andrey

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