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

Re: Completion lists



[you forgot to reply to all]

On 18 September 2011 16:03, Yuri D'Elia <wavexx@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, 18 Sep 2011 15:48:39 +0200, Mikael Magnusson wrote:
>>>
>>> % ls ///list<TAB>
>>> etc/  lib/  usr/
>>>
>>> but it's also pure chance, since PREFIX in this case seems to be
>>> "///list" which
>>> doesn't pass the "! -d" test (which is done for simple directories). I
>>> tried to
>>> write better code to handle this case, but "$compstate" doesn't seem to
>>> put
>>> anything meaningful (I was expecting insert_positions to be set to
>>> something!).
>>>
>>> Also, I could avoid the test entirely if I could set a different function
>>> when
>>> completing arguments instead of files. How can I do this?
>>
>> [...]
>>>
>>> zstyle -e ':completion:*' list-colors highlight-comp
>>
>> Here you can use something like ":completion:*:files:" instead, i
>> don't know off hand what the exact value you want is, bindkey some key
>> to _complete_help and check. Or maybe you want to make it match
>> against _files rather than the specific tag.
>
> I guess I want to match set a different functions depending whether I'm
> completing on _files or _arguments, but I'm unsure how to do that.
>
> $ vi ./d^xh
> tags in context :completion::complete:vi::
>    all-files  (_files _default (eval))
>
> Doing
>
> zstyle -e ':completion:*:files:' list-colors ..
>
> doesn't do what I mean.

As you can see, the tag here is "all-files", not "files". You also
need another * after the last :, I see that I missed that, sorry. I
think you can put either all-files or _files and it might work. Note
that if you set the list-dirs-first style, you'll get other-files and
directories instead of all-files.

-- 
Mikael Magnusson



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