diff options
author | LE Manh Cuong <cuong.manhle.vn@gmail.com> | 2015-12-01 11:50:55 +0700 |
---|---|---|
committer | LE Manh Cuong <cuong.manhle.vn@gmail.com> | 2015-12-18 08:28:22 +0700 |
commit | 531c41cdfee9e3bbba16d0bf19ca973ad4bb4af5 (patch) | |
tree | e833a5e68622d5eff5bdd7f378c3a8bf1400b130 | |
parent | f558a460c289a41811e0c4b89f04d539c66224a1 (diff) | |
download | zsh-531c41cdfee9e3bbba16d0bf19ca973ad4bb4af5.tar.gz zsh-531c41cdfee9e3bbba16d0bf19ca973ad4bb4af5.tar.bz2 zsh-531c41cdfee9e3bbba16d0bf19ca973ad4bb4af5.zip |
Allow loading themes from predefined list
-rw-r--r-- | oh-my-zsh.sh | 6 | ||||
-rw-r--r-- | templates/zshrc.zsh-template | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6cc5ac630..0324543d5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -94,7 +94,11 @@ unset config_file # Load the theme if [ "$ZSH_THEME" = "random" ]; then - themes=($ZSH/themes/*zsh-theme) + if [ "${(t)ZSH_THEME_RANDOM_CANDICATES}" = "array" ] && [ "${#ZSH_THEME_RANDOM_CANDICATES[@]}" -gt 0 ]; then + themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDICATES}.zsh-theme) + else + themes=($ZSH/themes/*zsh-theme) + fi N=${#themes[@]} ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 44e8b0d1b..baedf0675 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -7,6 +7,12 @@ export ZSH=$HOME/.oh-my-zsh # time that oh-my-zsh is loaded. ZSH_THEME="robbyrussell" +# Set list of themes to load +# Setting this variable when ZSH_THEME=random +# cause zsh load theme from this variable instead of +# looking in ~/.oh-my-zsh/themes/ +# ZSH_THEME_RANDOM_CANDICATES=() + # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" |