Random theme function can pick themes from favourite list

This commit is contained in:
volpino 2011-10-10 16:53:55 +02:00
commit e5b9f0043a

View file

@ -43,7 +43,18 @@ for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
# Load the theme # Load the theme
if [ "$ZSH_THEME" = "random" ] if [ "$ZSH_THEME" = "random" ]
then then
if [ -z $ZSH_FAVLIST ]
then
themes=($ZSH/themes/*zsh-theme) themes=($ZSH/themes/*zsh-theme)
else
content=(`cat $ZSH_FAVLIST`)
i=1
for theme in $content
do
themes[$i]=$ZSH/themes/$theme.zsh-theme
((i=i+1))
done
fi
N=${#themes[@]} N=${#themes[@]}
((N=(RANDOM%N)+1)) ((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]} RANDOM_THEME=${themes[$N]}