1

zsh completion functions, such as _describe or _arguments can add descriptions to their suggestions:

prompt% function _myfun() {thingstodo=('one:do one thing' 'nope:do nothing'); _describe 'possible things to do' thingstodo}
prompt% compdef _myfun myfun
prompt% myfun⇥
things to do:
nothing -- do nothing
one     -- do one thing

In case the completion is unambiguous, these descriptions are not shown, instead the only possible completion is inserted

prompt% myfun o⇥

results in

prompt% myfun one 

(a space is inserted after one and the cursor is at the end of the line).

Is there a way - as a user triggering the completion - to see the description anyway? E.g. for the case where I'm wondering "that one and only option, what is it doing again?" So I don't really want to manipulate the completion function itself, but rather have something globally. I imagine this could be a zle widget to trigger manually (possibly with moving the cursor to a different place or deleting the suggestion again if needed). Or maybe a zstyle?

1 Answer 1

2

Use the list-choices widget. By default this is bound to Ctrl-D (vi mode) and Meta-Ctrl-D (emacs mode).

Oliver

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .