zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Completion lists
Date: Tue, 13 Sep 2011 09:29:57 -0700	[thread overview]
Message-ID: <110913092957.ZM14421@torch.brasslantern.com> (raw)
In-Reply-To: <loom.20110913T170627-86@post.gmane.org>

On Sep 13,  3:16pm, Yuri DElia wrote:
}
} Bart Schaefer <schaefer <at> brasslantern.com> writes:
} 
} > zstyle -e ':completion:*:default' list-colors \
} >     'reply=("=(#b)${words[CURRENT]:t}(*)=0=7")'
} 
} Your code seem to fail badly with directories.
} For instance, completing anything with "./" will incorrectly skip the
} first two characters of the files themselves.

It works just fine from

zsh -f
autoload -Uz compinit
compinit -D
zstyle ...

and it also works with my own usual completion styles, so there's
something else in your configuration that's clashing with it.

[...]

} While I was waiting I kept trying

Always a good plan.

} and came up with this:
} 
} c='${PREFIX:+=(#b)($PREFIX:t)(?)*===$color[bold]}':'=(#b)(?)*==$color[bold]'
} zstyle -e ':completion:*' list-colors "reply=(\"$c\")"

Strictly speaking I think you should use =0=0=$color[bold]}, that may be
why strange things are getting highlighted in some of your attempts.  I
get different results with =0=0= vs ===.

} I'm wondering what variables could in the reply. I found $PREFIX in
} other examples, and now also $words[CURRENT]. Is there a list for
} these? Maybe I could make it work if I had SUFFIX/somethingelse.

All the completion special variables are listed in the "Completion
Special Parameters" section of the manual (info section 19.2 with the
latest CVS checkout).

The list-colors style is looked up several times during the course of
a typical completion, so it may get evaluated late enough for the
values of words / PREFIX / SUFFIX etc. to be accurate.  I still think
it's going to be difficult to get a single global list-colors style
that covers all the cases.


  parent reply	other threads:[~2011-09-13 16:30 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 [this message]
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
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=110913092957.ZM14421@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).