summaryrefslogtreecommitdiff
path: root/oh-my-zsh.sh
diff options
context:
space:
mode:
authorWilly Weiskopf <william@weiskopf.me>2014-07-16 22:21:09 -0600
committerMarc Cornellà <marc.cornella@live.com>2020-02-19 18:20:28 +0100
commit6adad5c300a6bfde33b593489cc1c3b645b721e8 (patch)
treeffc272716a4fce2ed12c4b833ff772a5f2e8067a /oh-my-zsh.sh
parentd76258ff554ea58d9865b9864f5fff1dd8d2e4bb (diff)
downloadzsh-6adad5c300a6bfde33b593489cc1c3b645b721e8.tar.gz
zsh-6adad5c300a6bfde33b593489cc1c3b645b721e8.tar.bz2
zsh-6adad5c300a6bfde33b593489cc1c3b645b721e8.zip
Move random theme functionality into "random" theme
The statements for selecting a random theme in oh-my-zsh.sh and the themes plugin are duplicate. Most people eventually settle on a theme, making those lines in oh-my-zsh.sh superfluous. To address those, it may makes sense to put the random theme functionality into a theme of its own (since themes are just zsh scripts.
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r--oh-my-zsh.sh25
1 files changed, 6 insertions, 19 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index c3fae6efb..30259372c 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -97,25 +97,12 @@ done
unset config_file
# Load the theme
-if [[ "$ZSH_THEME" == "random" ]]; then
- if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
- themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
+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
- themes=($ZSH/themes/*zsh-theme)
- fi
- 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
- 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"
- fi
+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi