zsh-users
 help / color / mirror / 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

zsh-users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-users

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-users zsh-users/ http://inbox.vuxu.org/zsh-users \
		zsh-users@zsh.org
	public-inbox-index zsh-users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git