add support for randomly selecting from a list of specific themes

This commit is contained in:
Clarence "Sparr" Risher 2016-04-19 16:17:03 -07:00
commit 54fbbf9e48
2 changed files with 12 additions and 2 deletions

View file

@ -92,6 +92,13 @@ for config_file ($ZSH_CUSTOM/*.zsh(N)); do
done done
unset config_file unset config_file
if [[ "$(declare -p ZSH_THEME) 2>/dev/null" =~ "(declare|typeset) -a" ]]; then
# Choose randomly from multiple specified themes
THEME_COUNT=${#ZSH_THEME[@]}
((THEME_N=(RANDOM%THEME_COUNT)+1))
ZSH_THEME=${ZSH_THEME[$THEME_N]}
fi
# Load the theme # Load the theme
if [ "$ZSH_THEME" = "random" ]; then if [ "$ZSH_THEME" = "random" ]; then
themes=($ZSH/themes/*zsh-theme) themes=($ZSH/themes/*zsh-theme)

View file

@ -3,9 +3,12 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. # Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/ # Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell" ZSH_THEME="robbyrussell"
# Optionally, if you set this to "random", it'll load a random non-custom
# theme each time that oh-my-zsh is loaded.
# ZSH_THEME="random"
# This can also be a list of specific themes to be chosen between at random
# ZSH_THEME=(arrow gallifrey robbyrussell smt wedisagree)
# Uncomment the following line to use case-sensitive completion. # Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true" # CASE_SENSITIVE="true"