zsh-users
 help / color / mirror / code / Atom feed
* How to make completion menu select navigation not wrap around?
@ 2020-04-04 15:06 Marlon Richert
  2020-06-06  5:37 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Marlon Richert @ 2020-04-04 15:06 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

When using arrow keys to navigate the completion menu, I do not want it to
wrap around (to the bottom row) when I press the up arrow key when I’m on
the top row of the menu. Instead, I want to go back to the command line.

Is there a zstyle to turn off menu wrapping? Or inside a widget function,
is there a parameter or function I can query to tell if the menu is open
and which line we’re on (so that I can then `send-break` instead of doing
`up-line`)?

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

* Re: How to make completion menu select navigation not wrap around?
  2020-04-04 15:06 How to make completion menu select navigation not wrap around? Marlon Richert
@ 2020-06-06  5:37 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2020-06-06  5:37 UTC (permalink / raw)
  To: Marlon Richert; +Cc: zsh-users

Marlon Richert wrote on Sat, 04 Apr 2020 18:06 +0300:
> When using arrow keys to navigate the completion menu, I do not want it to
> wrap around (to the bottom row) when I press the up arrow key when I’m on
> the top row of the menu. Instead, I want to go back to the command line.
> 
> Is there a zstyle to turn off menu wrapping? Or inside a widget function,
> is there a parameter or function I can query to tell if the menu is open
> and which line we’re on (so that I can then `send-break` instead of doing
> `up-line`)?

Sorry for the late answer.  The «menuselect» map can be used to bind
keys for navigating the menu, for example, to use Vi-like hjkl
navigation:

bindkey -M menuselect "h" backward-char
bindkey -M menuselect "j" down-line-or-history
bindkey -M menuselect "k" up-line-or-history
bindkey -M menuselect "l" forward-char

So I suppose you could bind up/down to functions that
decrement/increment a global counter respectively, and have the "up"
function send-break when the counter reaches zero.  Won't be perfect,
since pressing <Right> repeatedly can move to the next line, but might
work "well enough" in practice.

Cheers,

Daniel

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

end of thread, other threads:[~2020-06-06  5:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 15:06 How to make completion menu select navigation not wrap around? Marlon Richert
2020-06-06  5:37 ` Daniel Shahaf

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