Refactor loading of theme into function for reusability

- Make sure to load a new theme after user 'unlikes' a theme
This commit is contained in:
Luke Lee 2011-06-03 19:05:28 -05:00
commit 4a052e88df
2 changed files with 23 additions and 22 deletions

View file

@ -33,27 +33,13 @@ done
# Load all of your custom configurations from custom/
for config_file ($ZSH/custom/*.zsh) source $config_file
export FAVORITE_THEMES_DIR="$ZSH/themes/favorites/"
# Allow users to randomize themes with only their favorites
if [ ! -d $FAVORITE_THEMES_DIR ]; then
mkdir $FAVORITE_THEMES_DIR
fi
# Load the theme
# Check for updates on initial load...
if [ "$ZSH_THEME" = "random" ]; then
load_random_theme
elif [ "$ZSH_THEME" = "favorites" ]; then
# Only randomize with liked themes if there are any
if [ `ls $FAVORITE_THEMES_DIR | wc -w` -gt 0 ]; then
load_random_theme $FAVORITE_THEMES_DIR/*zsh-theme
else
load_random_theme
fi
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
# Allow users to randomize themes with only their favorites
if [ ! -d $FAVORITE_THEMES_DIR ]; then
mkdir $FAVORITE_THEMES_DIR
fi
# Load theme (random/favorite/specific)
load_theme
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" = "true" ]