Adds ability to comma-delimit the ZSH_THEME variable

This commit is contained in:
Brandon Sturgeon 2017-02-27 16:30:36 -06:00
parent b908feebcf
commit 1a6593b55f

View File

@ -102,12 +102,19 @@ if [ "$ZSH_THEME" = "random" ]; then
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else else
if [ ! "$ZSH_THEME" = "" ]; then if [ ! "$ZSH_THEME" = "" ]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then # Split by commas and randomly select a theme
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" themes=("${(s/,/)ZSH_THEME}")
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then N=${#themes[@]}
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ((N=(RANDOM%N)+1))
else SELECTED_THEME=${themes[$N]}
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
if [ -f "$ZSH_CUSTOM/$SELECTED_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/$SELECTED_THEME.zsh-theme"
elif [ -f "$ZSH_CUSTOM/themes/$SELECTED_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$SELECTED_THEME.zsh-theme"
else
source "$ZSH/themes/$SELECTED_THEME.zsh-theme"
fi fi
fi fi
fi fi