Re: select w.o. ENTER
Bart Schaefer <[email protected]> Wed, 6 May 2026 11:16:30 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7biqCKn07YOZ2aJ9dvQfQpAG7O3_kZWbcQagt-Q-VT_JQ@mail.gmail.com> |
On Wed, May 6, 2026 at 10:41=E2=80=AFAM Ray Andrews <[email protected]= > wrote: > > On 2026-05-06 09:54, Roman Perepelitsa wrote: > > How do you want to select the 11th item? Which keys do you want to > > press for that? > Ha! Good point, never thought of that. But supposing it was a short > list? One might want the option. Hm, the documentation, and the code for the "select" loop, suggests you should be able to examine $ZLE_STATE for the value "select" but I can't get that ever to be true. Aside to workers, code is: if (usezle) { int oef =3D errflag; isfirstln =3D 1; str =3D zleentry(ZLE_CMD_READ, &prompt3, NULL, 0, ZLCON_SELECT); if (errflag) str =3D NULL; /* Keep any user interrupt error status */ errflag =3D oef | (errflag & ERRFLAG_INT); but ZLCON_SELECT is never populated in $ZLE_STATE, it always comes back wit= h "globalhistory insert " However, this appears to work: qsel() { [[ ${(%):-%_} =3D *select* ]] && zle .accept-line || zle self-insert } zle -N qsel for key in {1..9}; do bindkey $key qsel done