Diff
1diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
2index 9b908bef00bf84ebf43655e17f7602a25818bf6a..c83f58c7b912b022eea7afa7d5d7038f0044032f 100644
3--- a/lib/theme-and-appearance.zsh
4+++ b/lib/theme-and-appearance.zsh
5@@ -7,32 +7,37 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
6 # TODO organise this chaotic logic
7
8 if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
9+ if [[ -d "$ZSH" ]]; then
10+ _test_dir="$ZSH"
11+ else
12+ _test_dir="."
13+ fi
14 # Find the option for using colors in ls, depending on the version
15 if [[ "$OSTYPE" == netbsd* ]]; then
16 # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
17 # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
18- gls --color -d . &>/dev/null && alias ls='gls --color=tty'
19+ gls --color -d "$_test_dir" &>/dev/null && alias ls='gls --color=tty'
20 elif [[ "$OSTYPE" == openbsd* ]]; then
21 # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
22 # with color and multibyte support) are available from ports. "colorls"
23 # will be installed on purpose and can't be pulled in by installing
24 # coreutils, so prefer it to "gls".
25- gls --color -d . &>/dev/null && alias ls='gls --color=tty'
26- colorls -G -d . &>/dev/null && alias ls='colorls -G'
27+ gls --color -d "$_test_dir" &>/dev/null && alias ls='gls --color=tty'
28+ colorls -G -d "$_test_dir" &>/dev/null && alias ls='colorls -G'
29 elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
30 # this is a good alias, it works by default just using $LSCOLORS
31- ls -G . &>/dev/null && alias ls='ls -G'
32+ ls -G "$_test_dir" &>/dev/null && alias ls='ls -G'
33
34 # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
35 # otherwise, gls will use the default color scheme which is ugly af
36- [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
37+ [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d "$_test_dir" &>/dev/null && alias ls='gls --color=tty'
38 else
39 # For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
40 if [[ -z "$LS_COLORS" ]]; then
41 (( $+commands[dircolors] )) && eval "$(dircolors -b)"
42 fi
43
44- ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
45+ ls --color -d "$_test_dir" &>/dev/null && alias ls='ls --color=tty' || { ls -G "$_test_dir" &>/dev/null && alias ls='ls -G' }
46
47 # Take advantage of $LS_COLORS for completion as well.
48 zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"