zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: How to make completion menu select navigation not wrap around?
Date: Sat, 6 Jun 2020 05:37:14 +0000	[thread overview]
Message-ID: <20200606053714.451d337a@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAHLkEDs4J5C5Vud7wvWxLhPJTZ293h+AYmeM8GCAVJ0J5ot5kA@mail.gmail.com>

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

      reply	other threads:[~2020-06-06  5:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 15:06 Marlon Richert
2020-06-06  5:37 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200606053714.451d337a@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=marlon.richert@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).