-1

I wanted to make custom colors for the ls command with zsh, but I find that all the previous answers to this do not work for me.

I tried all these options:

Option 1)

#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} 

Option 2)

#LS_COLORS='di=1:fi=96:*.m=31:*.py=32:*.txt=36:*.out=35' #export LS_COLORS #zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 

Option 3)

#zstyle ':completiom:*' list-colors 'di=1:fi=96:*.m=31:*.py=32:*.txt=36:*.out=35' 

Option 4)

#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' 

but all result of the ls command are displayed as if no color option was turned on.

The only thing that seems to work to change the colors at all is this:

unset LSCOLORS export CLICOLOR=1 export CLICOLOR_FORCE=1 

which I found from another answer somewhere that I can't find. However, what I want is to use my own custom colors indicated by:

#LS_COLORS='di=1:fi=96:*.m=31:*.py=32:*.txt=36:*.out=35' 

Appendix

  • For completness I also saw someone suggest to use gls but I had issues brew installing it so I gave up on that. Sorry can't find the link to that anymore.

Cross posted:

2
  • 3
    If you actually mentioned that you were using MacOS, answerers would not be off on wild goose chases with the Z shell, but would no doubt be providing short and to the point explanations of why a variable named LS_COLORS has no effect with BSD ls. They might even have pointed you in the direction of unix.stackexchange.com/a/137340/5132 where someone with a familiar name worked out the right variable names to use. (-: Commented Nov 14, 2019 at 16:48
  • 7
    Does this answer your question? How to change the output color of the ls command in terminal in OS X and iTerm2? Commented Jun 18, 2020 at 12:38

1 Answer 1

0

You might be missing zsh/complist module. Try zmodload zsh/complist.

Besides, if you want to have the ls colored output – which isn't something directly related to Zsh – then you should do: eval $(dircolors -b …path to the custom dircolors definitions…). Or use Zplugin and do:

zplugin wait"0c" lucid \ atload'zstyle ":completion:*" list-colors "${(s.:.)LS_COLORS}";' for \ zpm-zsh/dircolors-material 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.