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

Re: completion with separator



On Sat, May 7, 2022 at 3:41 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:

_values -s , categories $categories_array

> func a<tab>
<menu completion where I select a value with enter>
> func acat,<cursor>

I would like that the comma was not added automatically, or at least to be removed automatically when I select a voice in menu selection with enter.
is this possible?

It should already be happening that way.  If you type a space or another return after the comma, it should disappear.

If that's not happening the way you like, you can try some variation of

remove_comma=(-r '[:alnum:] \t\n\-')
_values -O remove_comma -s , categories $categories_array

to remove the comma when you type (in that example) anything alphanumeric or whitespace, but whether that works depends on how you've defined the specs in $categories_array (-O applies only to specs that have an "action" component).




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