In plain zsh, tree is set similar to --color=auto by default. However, when I use Oh-My-Zsh, tree doesn't show colors. Since tree does not have a --color=auto option, how can I override the setting back to the auto one?
Asked
Active
Viewed 4,039 times
7
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
Franklin Yu
- 1,227
- 12
- 23
-
Do you mean having no different colors by `--colors=auto`? – Mohammad Etemaddar Jun 04 '15 at 21:08
-
@MohammadEtemaddar Well, `ls` works well with `--color=auto`, but `tree` does not have such an option. If it had, I could have just solved the problem with `alias tree='tree --color=auto'`. – Franklin Yu Jun 05 '15 at 01:31
1 Answers
6
I found the answer after I posted an issue on Oh-My-Zsh's repository. Color in tree rely on LS_COLORS, which is not set by Zsh by default; but my ~/.zshrc set the variable after I hit "use default setting" option, with a single line
eval "$(dircolors -b)"
which looks insignificant. After installing Oh-My-Zsh, the setting is moved to ~/.zshrc.pre-oh-my-zsh, so LS_COLORS is lost again, and my tree becomes black and white.
In other words, I moved that setting from ~/.zshrc.pre-oh-my-zsh back to .zshrc, and I am now with my colorful tree.
Franklin Yu
- 1,227
- 12
- 23