From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6098 invoked by alias); 18 Sep 2011 13:42:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16381 Received: (qmail 12648 invoked from network); 18 Sep 2011 13:42:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.12 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri DElia Subject: Re: Completion lists Date: Sun, 18 Sep 2011 13:41:52 +0000 (UTC) Message-ID: References: <110913074320.ZM14249@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 93.89.57.166 (Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2 Iceweasel/6.0.2) Bart Schaefer 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 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? Thanks.