Zsh not recognizing ls colors

The proper way of configuring colors with GNU ls is using LS_COLORS (see https://superuser.com/a/530467/175441). Now assuming you have LS_COLORS set, you should now use

# Zsh to use the same colors as ls
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}  

BTW, the above works. Search for list-colors in the Zsh manual (i.e. man zshall). If you cannot get this to work, try running this (short LS_COLORS for convenience...):

LS_COLORS='no=00;37:fi=00:di=00;33:ln=04;36:pi=40;33:so=01;35:bd=40;33;01:'
export LS_COLORS
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

In my case, I also had to

export CLICOLOR=1

to get ls to colorize its output, as documented in man ls.


Turns out zsh doesn't like the way ls stores its colors. You have to convert the colors into something zsh understands.

zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'

Tags:

Terminal

Zsh