zsh-users
 help / color / mirror / code / Atom feed
From: Yuri D'Elia <wavexx@users.sourceforge.net>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Completion lists
Date: Sun, 18 Sep 2011 16:35:03 +0200	[thread overview]
Message-ID: <6a396ad05de36b6412b5f8643682672f@thregr.org> (raw)
In-Reply-To: <CAHYJk3QgaVHEOsteyS+M+W+JKd9tD=AFMOgC-8Kghiw0WEZCsg@mail.gmail.com>

 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<TAB>
 (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.


  reply	other threads:[~2011-09-18 14:56 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
     [not found]       ` <ed790212f803298ea33fd6091b9d5062@thregr.org>
2011-09-18 14:08         ` Mikael Magnusson
2011-09-18 14:35           ` Yuri D'Elia [this message]
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=6a396ad05de36b6412b5f8643682672f@thregr.org \
    --to=wavexx@users.sourceforge.net \
    --cc=mikachu@gmail.com \
    --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).