Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Implementing a menu (list) in a zsh script (as in command line)

I am writing an application in zsh. I typically use read -k or vared for
getting user input. However, I'd like the user to get a menu as he types or
tabs, just as it happens on the zsh command line. I'd like him to be able
to navigate the menu just as on the command line.

Currently, I've implemented this in some cases using read -k and displaying
the data again with each keystroke and the user has to type in the row
number to finally select a row. However, user cannot navigate. I'd like to
use zsh's inbuilt facilities if possible rather than reimplement.

Also in the case of using vared, I am unable to give any options (although
if it happens to be a path, then vared does allow tabbing and completion).

I did see an application that does implement something similar called
"zaw". It seems to use "zle" but I was lost reading the code. "man zle"
hasn't helped much and I could not find any simple tutorial or examples.

Also, using "read -k" can one accept control characters and arrow keys ? It
seems I would have to do multiple reads?

Messages sorted by: Reverse Date, Date, Thread, Author