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

Re: completion with separator



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

yes it is removed when I press a space after selection, and even if I press enter after the selection. But this way, in the enter case, the line is accepted and executed.
What I would like is for the comma not to be inserted after the completion, I would like to insert it by myself if I want to insert multiple arguments. So when I press enter in the menu selection the voice is selected and the line is:

func acat<cursor>

instead of 

func acat,<cursor>

thanks


Pier Paolo Grassi


Il giorno sab 7 mag 2022 alle ore 22:12 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> ha scritto:
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