Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Consider this minimal .zshrc :

export CLICOLOR=1;
export LSCOLORS=exfxcxdxbxegedabagacad; # It is the default value on OSX, so this line can be omitted

autoload -Uz compinit
compinit
zstyle ':completion:*' list-colors 'exfxcxdxbxegedabagacad'

On OS X, ls uses colors if CLICOLOR is set to TRUE and the colors used are in LSCOLORS which default value is exfxcxdxbxegedabagacad.

Doing a ls will print directories in blue. But when doing cd + TAB, ZSH will propose completions with directories in red and in bold. What is the problem and how can I have the same colors for ZSH completion and ls?

share|improve this question

migrated from stackoverflow.com May 30 '11 at 10:21

This question came from our site for professional and enthusiast programmers.

1 Answer 1

You need to read the instructions carefully: zsh knows how to handle LS_COLORS, which is the GNU/Linux variant of ls color configuration, but you use OSX's/BSD's LSCOLORS. They are very different, and it appears zsh doesn't know how to handle the latter.

LSCOLORS example for red output:

bbbbbbbbbbbbbbbbbbbbbb

LS_COLORS example for red output:

di=31;41:ln=31;41:so=31;41:pi=31;41:ex=31;41:bd=31;41:cd=31;41:su=31;41:sg=31;41:tw=31;41:ow=31;41:

Use e.g. this tool (also on Github) to create a nice color scheme, or recreate the one you use, copy its output for Linux LS_COLORS, then use the following to set the colors:

# between quotation marks is the tool output for LS_COLORS
export LS_COLORS="di=31;41:ln=31;41:so=31;41:pi=31;41:ex=31;41:bd=31;41:cd=31;41:su=31;41:sg=31;41:tw=31;41:ow=31;41:"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.