From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13418 invoked from network); 30 Aug 2008 14:17:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Aug 2008 14:17:17 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 55863 invoked from network); 30 Aug 2008 14:17:10 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Aug 2008 14:17:10 -0000 Received: (qmail 21287 invoked by alias); 30 Aug 2008 14:17:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25559 Received: (qmail 21270 invoked from network); 30 Aug 2008 14:17:02 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 30 Aug 2008 14:17:02 -0000 Received: from eris.feh.name (eris.feh.name [88.198.13.233]) by bifrost.dotsrc.org (Postfix) with ESMTP id 4B9798058F4D for ; Sat, 30 Aug 2008 16:16:58 +0200 (CEST) Received: by eris.feh.name (Postfix, from userid 1000) id D1796F6012A; Sat, 30 Aug 2008 16:16:55 +0200 (CEST) Date: Sat, 30 Aug 2008 16:16:55 +0200 From: Julius Plenz To: zsh-workers@sunsite.dk Subject: Re: Module zsh/complist and coloring Message-ID: <20080830141655.GL16053@plenz.com> Mail-Followup-To: Julius Plenz , zsh-workers@sunsite.dk References: <20080827140221.GZ3846@plenz.com> <20080830124321.7990824d@pws-pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080830124321.7990824d@pws-pc> X-PGP-Key: 0x186DCA0D X-URL: http://www.plenz.com/ X-Editor: Vim 7.0 - set ai et ts=4 tw=70 comments=b:#,:%,fb:-,n:>,n:) nosm nonu User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV 0.92.1/8120/Sat Aug 30 05:43:49 2008 on bifrost X-Virus-Status: Clean Hi! * Peter Stephenson [2008-08-30 13:43]: > Julius Plenz wrote: > > Since you cannot download non-files, it'd make sense to have a > > possibility to tell compadd or the complist module that the > > matches are all valid filenames, no need for checking that. > > Sounds plausible, although you'd only get half the full effect > unless you could also supply the file type (most particularly > directory or regular file). Well, you can! In that same mail I also wrote: > But especially for _remote_files, from the trailing slash you can > tell directories from files apart. I figured out a way to emulate the coloring, although (because you don't have access to the file attributes) you can color the matches only per extension. This snippet displays directories and files in the colors supplied by $LS_COLORS: scp_colors=("=(#b)(*)/=0="${${${(s.:.)LS_COLORS}[(r)di=<->]}/di=/}) for c (${(s.:.)LS_COLORS}) [[ $c == \** ]] && scp_colors+=('='$c) zstyle ':completion::*:scp:*' list-colors $scp_colors unset scp_colors Actually, you can boil this down to a single zstyle call: zstyle ':completion::*:scp:*' list-colors \ "=(#b)(*)/=0="${${${(s.:.)LS_COLORS}[(r)di=<->]}/di=/} \ '='${^${(M)${(s.:.)LS_COLORS}:#\**}} Of course, the coloring for local files is also changed when you want to upload local files using scp. I don't think there's a way to tell from the context whether you're completing local or remote files. This solution is not too bad, though. Greetings, Julius