efa7c7b7ff72953368dfaba979e3014826bf1837

Author
Hong Xu <hong@topbug.net>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

set better default colors for GNU ls instead of none.

GNU coreutils ship a color setup command by default which can be used to
set a good default color theme for ls:

  https://www.gnu.org/software/coreutils/manual/html_node/dircolors-invocation.html

Diff

 1diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
 2index 5c5bb0e6d3a3586ba89208bab51256d56b01e448..585f872e18b87819586421cf55b258e232599169 100644
 3--- a/lib/theme-and-appearance.zsh
 4+++ b/lib/theme-and-appearance.zsh
 5@@ -5,7 +5,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
 6 # Enable ls colors
 7 if [ "$DISABLE_LS_COLORS" != "true" ]
 8 then
 9-  # Find the option for using colors in ls, depending on the version: Linux or BSD
10+  # Find the option for using colors in ls, depending on the version: GNU or BSD
11   if [[ "$(uname -s)" == "NetBSD" ]]; then
12     # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
13     # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
14@@ -18,6 +18,8 @@ then
15     gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
16     colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
17   else
18+    # For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
19+    type dircolors >/dev/null 2>&1 && eval "$(dircolors)"
20     ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
21   fi
22 fi