From ab53d842a9fe3396c9bfbc9cd7b9dec7aec1126b Mon Sep 17 00:00:00 2001 From: Joe Bloggs Date: Thu, 20 Mar 2014 14:01:33 +0000 Subject: [PATCH] Add _comma_separated helper function Helper function for completing comma separated values --- src/_comma_separated | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/_comma_separated diff --git a/src/_comma_separated b/src/_comma_separated new file mode 100644 index 0000000..2f59505 --- /dev/null +++ b/src/_comma_separated @@ -0,0 +1,11 @@ +#autoload + +# This function can be used to complete comma separated values. +# The first argument should be a description for the completion items, +# and any further args are the completion items themselves. + +compset -P '*,' +local -a used vals +used=(${(s:,:)IPREFIX}) +_wanted tty expl $1 compadd -S ',' -q -F used "$@[2,-1]" +