From a812654cbed305398a078cac3d23e6a498da4f15 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Mon, 28 Nov 2011 09:24:49 -0500 Subject: [PATCH] Swapped out ZSH_THEME for two functions, set_theme and random_theme. At the moment I dropped ZSH_THEME variable too. Auto completion to come. Function makes it easier to change themes on-the-fly. --- oh-my-zsh.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 891e8d467..460399fc4 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -40,19 +40,12 @@ done # Load all of your custom configurations from custom/ for config_file ($ZSH_CUSTOM/*.zsh) source $config_file -# Load the theme -if [ "$ZSH_THEME" = "random" ] -then - themes=($ZSH/themes/*zsh-theme) - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." -else - if [ ! "$ZSH_THEME" = "" ] - then - source "$ZSH/themes/$ZSH_THEME.zsh-theme" - fi -fi +set_theme() { + source "$ZSH/themes/$ZSH_THEME.zsh-theme" +} +random_theme() { + local themes + themes=($ZSH/themes/*zsh-theme) + source "$themes[$RANDOM%$#themes+1]" +}