c24dfa1ab4abb1f28fad7666f3bc24f3abced801

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Fix ls coloring in MacOS if gls is not installed

Fixes #5520.

Diff

 1diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
 2index 0fd3c44db38ec6f521a42bfa77a2f83168077184..467b770d66e93e727f8dcfe9a47ef6ef407d8c3c 100644
 3--- a/lib/theme-and-appearance.zsh
 4+++ b/lib/theme-and-appearance.zsh
 5@@ -6,7 +6,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
 6 
 7 if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
 8   # Find the option for using colors in ls, depending on the version
 9-  if [[ "$OSTYPE" == netbsd* ]] || [[ "$OSTYPE" == darwin* ]]; then
10+  if [[ "$OSTYPE" == netbsd* ]]; then
11     # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
12     # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
13     gls --color -d . &>/dev/null && alias ls='gls --color=tty'
14@@ -17,6 +17,8 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
15     # coreutils, so prefer it to "gls".
16     gls --color -d . &>/dev/null && alias ls='gls --color=tty'
17     colorls -G -d . &>/dev/null && alias ls='colorls -G'
18+  elif [[ "$OSTYPE" == darwin* ]]; then
19+    gls --color -d . &>/dev/null && alias ls='gls --color=tty' || alias ls='ls -G'
20   else
21     # For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
22     if [[ -z "$LS_COLORS" ]]; then