zsh-workers
 help / color / mirror / code / Atom feed
* Menu selection by number
@ 2021-06-24 18:57 Timo
  2021-06-24 19:33 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Timo @ 2021-06-24 18:57 UTC (permalink / raw)
  To: zsh-workers

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

Hello there,

I'd like to pose the following suggestion: 

Display menu options prepended with a selection number which can be used by user to select option by typing the number.
Motivation: I am using voice programming and numbers are a great visual aid in quickly selecting options. Anyone who wants to type even less could make good use of it.

It could behave this way:
The autocompletion menu lists some options
The options should be prepended by a uniquely identifiable number each (for the current menu display)
If the user types further and the menu changes, the options' numbers are reassigned to the newly displayed options.
Numbers should be displayed in a sorted manner.


Example:

> ls
test_file1 testfile1  testfile_1 testfile_2 testfile_3 testfile_4 testfile_5

# Press tab opens auto completion menu 
# without numbers
> ls test
test_file1  testfile1   testfile_1  testfile_2  testfile_3  testfile_4  testfile_5

# with numbers
> ls test
1: test_file1  2: testfile1   3: testfile_1  4: testfile_2  5: testfile_3  6: testfile_4  7: testfile_5
# typing 3 (or for example ALT+3) would complete with `testfile_1`.


What's your opinion on this?




[-- Attachment #2: Type: text/html, Size: 2184 bytes --]

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

* Re: Menu selection by number
  2021-06-24 18:57 Menu selection by number Timo
@ 2021-06-24 19:33 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2021-06-24 19:33 UTC (permalink / raw)
  To: Timo; +Cc: zsh-workers

Timo wrote on Thu, Jun 24, 2021 at 20:57:57 +0200:
> Hello there,
> 
> I'd like to pose the following suggestion: 
> 
> Display menu options prepended with a selection number which can be used by user to select option by typing the number.
> Motivation: I am using voice programming and numbers are a great visual aid in quickly selecting options. Anyone who wants to type even less could make good use of it.
> 
> It could behave this way:
> The autocompletion menu lists some options
> The options should be prepended by a uniquely identifiable number each (for the current menu display)
> If the user types further and the menu changes, the options' numbers are reassigned to the newly displayed options.
> Numbers should be displayed in a sorted manner.
> 
> 
> Example:
> 
> > ls
> test_file1 testfile1  testfile_1 testfile_2 testfile_3 testfile_4 testfile_5
> 
> # Press tab opens auto completion menu 
> # without numbers
> > ls test
> test_file1  testfile1   testfile_1  testfile_2  testfile_3  testfile_4  testfile_5
> 
> # with numbers
> > ls test
> 1: test_file1  2: testfile1   3: testfile_1  4: testfile_2  5: testfile_3  6: testfile_4  7: testfile_5
> # typing 3 (or for example ALT+3) would complete with `testfile_1`.
> 
> 
> What's your opinion on this?

I wonder if we should just make choosing a completion pluggable: have
compsys call some user-defined function with the possible completions as
arguments and let the function report to us which one was selected.
Then, implementing a «select»-like numbered list, or "search completions
by description", or for that matter a GUI selection dialog with bells
and whistles for cases that offer completions from multiple tags (e.g.,
«ssh <TAB>», «git checkout <TAB>», with «tag-order ''» set), could then
be done in third-party plugins.

(«select» is a shell builtin.)

Also related:

- list-colors can be used to hide the common, already-typed part of
  completions, and colorize the first differing letter: https://www.zsh.org/workers/38518

- The _match completer lets one choose a completion by globbing to it.
  (E.g., «ssh *lsh<TAB>» → «ssh danielsh@<CURSOR>»)

Cheers,

Daniel
(Aside: Would a non-looping variant of «select» be a good idea?)


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

end of thread, other threads:[~2021-06-24 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 18:57 Menu selection by number Timo
2021-06-24 19:33 ` 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).