diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 72527362f..b7e08ced9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -103,12 +103,19 @@ if [[ "$ZSH_THEME" == "random" ]]; then echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else if [ ! "$ZSH_THEME" = "" ]; then - if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" - elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" - else - source "$ZSH/themes/$ZSH_THEME.zsh-theme" + # Split by commas and randomly select a theme + themes=("${(s/,/)ZSH_THEME}") + N=${#themes[@]} + ((N=(RANDOM%N)+1)) + SELECTED_THEME=${themes[$N]} + + 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 + diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index bba2d370d..9f662cc16 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -6,6 +6,8 @@ export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. +# You may provide multiple theme names delimited by commas "," and one +# will be randomly selected each time that oh-my-zsh is loaded. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes ZSH_THEME="robbyrussell"