2 autoload -U colors && colors
5 export LSCOLORS="Gxfxcxdxbxegedabagacad"
7 # TODO organise this chaotic logic
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|freebsd)* ]]; then
23 # this is a good alias, it works by default just using $LSCOLORS
24 ls -G . &>/dev/null && alias ls='ls -G'
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'
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)"
35 ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
37 # Take advantage of $LS_COLORS for completion as well.
38 zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
42 # enable diff color if possible.
43 if command diff --color /dev/null /dev/null &>/dev/null; then
44 alias diff='diff --color'
51 [[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
53 # git theming default: Variables for theming the git info prompt
54 ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
55 ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
56 ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
57 ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
58 ZSH_THEME_RUBY_PROMPT_PREFIX="("
59 ZSH_THEME_RUBY_PROMPT_SUFFIX=")"