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

Auto-insertion of quotes when completing



I'm writing a completion for xmms that allows me to complete among all
my music files from the command line. The script that invokes xmms is
called mu, and is used like this:

mu Foo<TAB>  ->  mu Fooband\ -\ B<TAB>  ->  mu Fooband\ -\ Barsong

I often prefer to quote the argument to mu, because it looks better
and makes it easier to chose among files whose names contain funny
characters. That is:

mu "Foo<TAB>  ->  mu "Fooband - B<TAB>  ->  mu "Fooband - Barsong"
(I chose " instead of ' since ' is a more common character in my
files' names, and \" looks better than '\'' anyway)

I was wondering if there is some way to have the completion
automatically quoted when I first press tab, so that the following
would work:

mu Foo<TAB>  ->  mu "Fooband - B<TAB>  ->  etc.

The normal auto-quoting of " when pressing tab should of course still
apply, so the following should be handled correctly:

mu Thi<TAB>  ->  mu "This song's name has a \" in it"

Is there some (easy) way to do this?

Ulf



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