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
>
> I would like that the comma was not added automatically

Sometimes you have to go closer to the metal, so to speak.

_comma_cats() {
  local categories_array=(aa bb cc)
  if compset -P '*,'
  then
    local already_there=${${IPREFIX//,/|}%|}
    categories_array=(${categories_array:#${~already_there}})
  fi
  compadd -S '' -X categories -a categories_array
}




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