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

Re: trying to learn zstyle



Hi Peter,
	Thanks for your wonderfull explanation!

	While you have fixed all my problems, I still have to say, the
	zsh command completion is way too complex for a general user to
	program it, or compare to compctl.

	But I guess that is a trade off between powerfull and easy to
	use.

	I would love to see that in the zsh documentations, there will
	be more examples to teach users how to program the command
	completion. It would be easier for users to get started, and
	they can try to understand the entire completion system later. 

	At the moment, there is only one short example about 'kill' in
	the documentation, and I found it is quite hard for me to derive
	from it.

	Thanks for you help again. And thanks for creating this
	wonderfull shell. I am now completely switched from bash to zsh.

Cheers,

Shao.


Peter Stephenson [pws@xxxxxxxxxxxxxxxxxxxxxxxx] wrote:
> Shao Zhang wrote:
> > 	How do I use zstyle to make mtvp to complete to the files with
> > 	*.mpg or *.mpeg or *.MPG and so on.
> 
> Sorry, missed this bit.  The easy answer (again, this is post-3.1.6) is
> 
> 
> _mtvp() { 
>   local expl
> 
>   _description files expl 'MPEG file'
>   _files "$expl[@]" -g '*.(mpg|mpeg|MPG)'
> }
> compdef _mtvp mtvp
> 
> 
> I got that simply by copying the file _gunzip, which does the same thing
> with .gz files.  Copying existing files is usually the way.
> 
> -- 
> Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>

-- 
____________________________________________________________________________
Shao Zhang - Running Debian 2.1  ___ _               _____
Department of Communications    / __| |_  __ _ ___  |_  / |_  __ _ _ _  __ _ 
University of New South Wales   \__ \ ' \/ _` / _ \  / /| ' \/ _` | ' \/ _` |
Sydney, Australia               |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@xxxxxxxxxx                                                  |___/ 
_____________________________________________________________________________



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