From: Mikael Magnusson <mikachu@gmail.com>
To: Yuri DElia <wavexx@users.sf.net>
Cc: zsh-users@zsh.org
Subject: Re: Completion lists
Date: Sun, 18 Sep 2011 15:48:39 +0200 [thread overview]
Message-ID: <CAHYJk3RzQ7sJ5--SzKC3zxb_6+cffj25_aSRiACbSShrJvJDOg@mail.gmail.com> (raw)
In-Reply-To: <loom.20110918T151744-181@post.gmane.org>
On 18 September 2011 15:41, Yuri DElia <wavexx@users.sf.net> wrote:
> Bart Schaefer <schaefer <at> brasslantern.com> writes:
>
>> If someone builds up a useful set of these based on this example, please
>> post back to the list.
>
> Just for posterity, this is what I've using since a couple of days:
>
> ##################
> # completition list colorization (emacs style)
> highlight-comp()
> {
> reply=()
> [ -n "$PREFIX" -a ! -d "$PREFIX" ] && reply+=( "=(#b)${PREFIX:q:t}(?)*==1" )
> reply+=( "=(#b)(?)*==1" )
> }
>
> zstyle -e ':completion:*' list-colors highlight-comp
> ##################
>
> It seems to work fine for most cases. This particular code also seems to avoid
> the reset bug as mentioned before (although this wasn't intended).
>
> Is also works for in-word completions, like this:
>
> % 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.
--
Mikael Magnusson
next prev parent reply other threads:[~2011-09-18 13:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 12:54 Yuri DElia
2011-09-13 14:43 ` Bart Schaefer
2011-09-13 15:16 ` Yuri DElia
2011-09-13 16:07 ` Yuri DElia
2011-09-13 17:40 ` Bart Schaefer
2011-09-13 18:48 ` Yuri DElia
2011-09-16 21:04 ` Peter Stephenson
2011-09-16 21:07 ` Peter Stephenson
2011-09-13 16:29 ` Bart Schaefer
2011-09-13 17:11 ` Yuri DElia
2011-09-18 13:41 ` Yuri DElia
2011-09-18 13:48 ` Mikael Magnusson [this message]
[not found] ` <ed790212f803298ea33fd6091b9d5062@thregr.org>
2011-09-18 14:08 ` Mikael Magnusson
2011-09-18 14:35 ` Yuri D'Elia
2011-09-16 21:58 ` Tomasz Pala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3RzQ7sJ5--SzKC3zxb_6+cffj25_aSRiACbSShrJvJDOg@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=wavexx@users.sf.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).