-rw-r--r-- oh-my-zsh/theme-and-appearance.zsh
1 # ls colors 2 autoload -U colors && colors 3 4 # Enable ls colors 5 export LSCOLORS="Gxfxcxdxbxegedabagacad" 6 7 # TODO organise this chaotic logic 8 9 if [[ "$DISABLE_LS_COLORS" != "true" ]]; then 10 # Find the option for using colors in ls, depending on the version 11 if [[ "$OSTYPE" == 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 gls --color -d . &>/dev/null && alias ls='gls --color=tty' 15 elif [[ "$OSTYPE" == openbsd* ]]; then 16 # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, 17 # with color and multibyte support) are available from ports. "colorls" 18 # will be installed on purpose and can't be pulled in by installing 19 # coreutils, so prefer it to "gls". 20 gls --color -d . &>/dev/null && alias ls='gls --color=tty' 21 colorls -G -d . &>/dev/null && alias ls='colorls -G' 22 elif [[ "$OSTYPE" == darwin* ]]; then 23 # this is a good alias, it works by default just using $LSCOLORS 24 ls -G . &>/dev/null && alias ls='ls -G' 25 26 # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file) 27 # otherwise, gls will use the default color scheme which is ugly af 28 [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty' 29 else 30 # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. 31 if [[ -z "$LS_COLORS" ]]; then 32 (( $+commands[dircolors] )) && eval "$(dircolors -b)" 33 fi 34 35 ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' } 36 37 # Take advantage of $LS_COLORS for completion as well. 38 zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" 39 fi 40 fi 41 42 setopt auto_cd 43 setopt multios 44 setopt prompt_subst 45 46 [[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" 47 48 # Apply theming defaults 49 #PS1="%n@%m:%~%# " 50