From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1927 invoked by alias); 18 Sep 2011 14:56:23 -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: 16385 Received: (qmail 22694 invoked from network); 18 Sep 2011 14:56:21 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at users.sourceforge.net does not designate permitted sender hosts) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 18 Sep 2011 16:35:03 +0200 From: Yuri D'Elia To: Mikael Magnusson Cc: Zsh Users Subject: Re: Completion lists In-Reply-To: References: <110913074320.ZM14249@torch.brasslantern.com> Message-ID: <6a396ad05de36b6412b5f8643682672f@thregr.org> X-Sender: wavexx@users.sourceforge.net User-Agent: Roundcube Webmail/0.5.1 On Sun, 18 Sep 2011 16:08:29 +0200, Mikael Magnusson wrote: >> 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. Ah, thanks! This: ###### # completition list colorization (emacs style) highlight-comp() { reply=( "=(#b)${PREFIX:q}(?)*==1" ) } highlight-comp-files() { reply=() [ -n "$PREFIX" -a ! -d "$PREFIX" ] && reply+=( "=(#b)${PREFIX:q:t}(?)*==1" ) reply+=( "=(#b)(?)*==1" ) } zstyle -e ':completion:*' list-colors highlight-comp zstyle -e ':completion:*:all-files' list-colors highlight-comp-files ###### ...now covers a couple more edge cases where an argument might match some existing files (git completion being one of the main offenders ;)). One more thing I'd like to cover when completing files. Is there a way to get the prefix up to the insert position when completing something like: ls ///list (where the cursor is placed just after the first /) Looking at the documentation, $compstate should help, but inside the callback function PREFIX is still set to "///list" and $compstate[insert_positions] is empty.