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

Limitations of menuselect



Hi,

I recently discovered the menu selection feature and I would like to
use it. Unfortunately, it doesn't work as well as I expected (using
zsh 5.0.0), so here are some bug reports and suggestions.

1) Custom bindings don't work. You can try it with the following:
    my-widget() { zle down-line-or-history }; zle -N my-widget;
bindkey -M menuselect k my-widget
(replacing "my-widget" with "down-line-or-history" in the bindkey
command works as expected).
Someone told me on IRC that in menuselect a hard-coded table is used
to lookup the widget names. So, could you add support for custom
widgets in menuselect? This would allow many cool things, in
particular, I think it would let me work-around items 2, 3 and 4
below.

2) Moving the selected menu item line by line is nice, but scrolling
several lines at a time would be nicer (that's what I would expect
PageUp and PageDown to do by default in menuselect, for example). I
couldn't find an existing widget for that.

3) When using the reverse-menu-complete widget to open menuselect, I
would like to select the last result, not the first one (otherwise I
can use menu-complete directly...). It doesn't sem to be possible at
the moment.

4) When moving the selection in the menu, the inserted text changes.
But for some reason, the accept-line widget only closes the menu,
without accepting the line. So to really accept the line I have to
call accept-line again (basically, I have to hit Enter twice). This
behavior seems a bit backwards: if I wanted to accept the current
selection, which is already inserted, I could simply go on typing, I
don't need an extra validation step. So, would it be possible to have
accept-line really accept the line? :) If the current behavior is
still wanted, it could maybe be called "accept-selection", because the
current name is misleading...

5) Apparently, menuselect always inserts the selected text. But if
there was a way (maybe using a style) to select a menu entry without
inserting the corresponding text, it could allow a killer feature:
typing characters could shrink the list of results (for example, by
binding individual letter keys to an appropriate widget...
accept-line-and-infer-history maybe?), while still allowing to select
an item using the arrow keys. Users would get the best of the 2
worlds: if the completion list is too long, typing letters would
shrink it until it's small enough to use arrow keys. Currently, it's
really annoying to open the menu, realize that there are way too many
entries to complete using movement keys, and then undo, type a few
more letters, hoping that this time the menu will not be too long...
:)
Of course, I could use a list instead of a menu, to avoid undoing the
completion if there are too many results. But this wouldn't really
solve the problem: if I use the list-choices widget
In case my description is not clear, you can have a look at the
AutoComplPop plugin for Vim [1], which does exactly that by default
(except that in addition it opens the menu automatically). It's really
a huge time saver.
Would that be possible to implement this feature (optional
non-insertion of selected text)?

I hope that these remarks make sense and that I haven't overlooked
some existing features...

Please Cc: me in the replies, as I didn't subscribe to the list.

Cheers,
-- 
Olivier
[1] http://www.vim.org/scripts/script.php?script_id=1879



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