Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ZLS_COLORS is reset on completion?

64 views
Skip to first unread message

phil.g...@gmail.com

unread,
Feb 6, 2012, 8:43:17 PM2/6/12
to
I'm using Zsh and when I do a completion, my ZLS_COLORS variable is
reset to some default value:

% export ZLS_COLORS='di=34'

% echo $ZLS_COLORS
di=34

% ls a<Tab>
a1/ a2/
^C

% echo $ZLS_COLORS
:*.jar=01;31:*.doc=35:*.pdf=35:*.ps=35:*.xls=35:*~=37:*.html=35:*.htm=35:*.pdf=35:*.ps=35:
(-
default-):*.jar=01;31:*.doc=35:*.pdf=35:*.ps=35:*.xls=35:*~=37:*.html=35:*.htm=35:*.pdf=35:*.ps=35

What could be going on here?

I want to see directories in blue but they are showing in red. And the
default ZLS_COLORS value does not even specify a color for directories.

Stephane Chazelas

unread,
Feb 7, 2012, 10:08:49 AM2/7/12
to
2012-02-06 17:43:17 -0800, p...@gmail.com:
Adjust ls completion to your test with

dircolors -p > ~/.dircolors
vi ~/.dircolors

And add

eval "$(dircolors -b ~/.dircolors)"
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

to your ~/.zshrc

--
Stephane

phil.g...@gmail.com

unread,
Feb 7, 2012, 9:12:31 PM2/7/12
to
On Feb 7, 7:08 am, Stephane Chazelas <stephane_chaze...@yahoo.fr>
wrote:
Thanks for the tip! Unfortunately, my dircolors does not work:

% eval $(dircolors -b ~/temp)

% echo $LS_COLORS

% echo $ZLS_COLORS

Yet "ls" still shows directories in blue.

If I set LS_COLORS explicitly instead, it works as before (e.g. zsh
completions show directories in red).

I'm running a recent version of Zsh: 4.3.12 and dircolors from GNU
coreutils 5.97 (2006).

Do you have any other hints?

Stephane Chazelas

unread,
Feb 8, 2012, 10:55:25 AM2/8/12
to
2012-02-07 18:12:31 -0800, p...@gmail.com:
[...]
> > dircolors -p > ~/.dircolors
> > vi ~/.dircolors
> >
> > And add
> >
> > eval "$(dircolors -b ~/.dircolors)"
> > zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
> >
> > to your ~/.zshrc
[...]
> Thanks for the tip! Unfortunately, my dircolors does not work:
>
> % eval $(dircolors -b ~/temp)
>
> % echo $LS_COLORS

That doesn't match what I wrote. You forgot some quotes.

Also, what's in your ~/temp? Is it really based on the output of
dircolors -p? What does dircolors -b output?

> % echo $ZLS_COLORS

The solution I gave doesn't set $ZLS_COLORS, but uses the zstyle
way instead. You should probably avoid setting it as it may
cause conflicts.

--
Stephane

phil.g...@gmail.com

unread,
Feb 15, 2012, 3:37:06 PM2/15/12
to
On Feb 8, 7:55 am, Stephane Chazelas <stephane_chaze...@yahoo.fr>
wrote:
> 2012-02-07 18:12:31 -0800, p...@gmail.com:
> [...]
>
> > > dircolors -p > ~/.dircolors
> > > vi ~/.dircolors
>
> > > And add
>
> > > eval "$(dircolors -b ~/.dircolors)"
> > > zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
>
> > > to your ~/.zshrc
> [...]
> > Thanks for the tip! Unfortunately, my dircolors does not work:
>
> > % eval $(dircolors -b ~/temp)
>
> > % echo $LS_COLORS
>
> That doesn't match what I wrote. You forgot some quotes.
>
> Also, what's in your ~/temp? Is it really based on the output of
> dircolors -p? What does dircolors -b output?

Sorry, I had made ~/temp to simplify the color specifications so that
it is easier to debug. Here is what happens with the commands you
wrote:

% dircolors -p > ~/.dircolors
% less ~/.dircolors
% eval "$(dircolors -b ~/.dircolors)"
% echo $LS_COLORS

% zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
% ls a<tab>
abc/ abd/

Not surprisingly, the directories are not colored because LS_COLORS is
empty.

It works as expected in Bash-terminal but not in Xterm. So I thought
maybe it has to do with my X resources, but that does not seem to
affect it either:

% xrdb -remove
% xrdb -query
% eval "$(dircolors -b ~/.dircolors)"
% echo $LS_COLORS

% # Still empty.


> > % echo $ZLS_COLORS
>
> The solution I gave doesn't set $ZLS_COLORS, but uses the zstyle
> way instead. You should probably avoid setting it as it may
> cause conflicts.

I see.

> --
> Stephane

Thanks for your help!
Philip
0 new messages