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

Re: Using the same completion function for various commands



On 6 December 2010 16:11, Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> On Mon, 6 Dec 2010 16:03:51 +0100
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
>> 2010/12/6 JÃrÃmie Roquet <arkanosis@xxxxxxxxx>:
>> > Hi,
>> >
>> > 2010/12/6 Mikael Magnusson <mikachu@xxxxxxxxx>:
>> >> You can also do this in your .zshrc instead of in the completer if
>> >> you wish, just write
>> >> compdef _foo -p 'foo_*'
>> >>
>> >> At least that's what the documentation says, it doesn't seem to
>> >> work that well.
>> >
>> > It works fine for me with 4.3.10, did I miss something?
>>
>> When i tried compdef _du -p foo_\*, i only got single-letter options
>> completed.
>>
>
> That means it's working perfectly. ÂIt's hitting this line at the top of
> _du
>
> Â_pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file
>
> and deciding, quite reasonably in my opinion, that foo_\* is not a GNU
> variant of du. ÂSo it's going to the other branch, where the options are
> simpler.

Ah, er, right. But. Is there any way to combine -p and saying foo=du ?
When I tried compdef _du -p 'foo_*=du' nothing happened.

-- 
Mikael Magnusson



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