theme-and-appearance.zsh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # ls colors
  2. autoload -U colors && colors
  3. # Enable ls colors
  4. export LSCOLORS="Gxfxcxdxbxegedabagacad"
  5. # TODO organise this chaotic logic
  6. if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
  7. # Find the option for using colors in ls, depending on the version
  8. if [[ "$OSTYPE" == netbsd* ]]; then
  9. # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
  10. # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
  11. gls --color -d . &>/dev/null && alias ls='gls --color=tty'
  12. elif [[ "$OSTYPE" == openbsd* ]]; then
  13. # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
  14. # with color and multibyte support) are available from ports. "colorls"
  15. # will be installed on purpose and can't be pulled in by installing
  16. # coreutils, so prefer it to "gls".
  17. gls --color -d . &>/dev/null && alias ls='gls --color=tty'
  18. colorls -G -d . &>/dev/null && alias ls='colorls -G'
  19. elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
  20. # this is a good alias, it works by default just using $LSCOLORS
  21. ls -G . &>/dev/null && alias ls='ls -G'
  22. # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
  23. # otherwise, gls will use the default color scheme which is ugly af
  24. [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
  25. else
  26. # For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
  27. if [[ -z "$LS_COLORS" ]]; then
  28. (( $+commands[dircolors] )) && eval "$(dircolors -b)"
  29. fi
  30. ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
  31. # Take advantage of $LS_COLORS for completion as well.
  32. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
  33. fi
  34. fi
  35. setopt auto_cd
  36. setopt multios
  37. setopt prompt_subst
  38. [[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
  39. # git theming default: Variables for theming the git info prompt
  40. ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
  41. ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
  42. ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
  43. ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean