5e77e00ad522a5d6a84067d22015b85b0080a19f

Author
LE Manh Cuong <cuong.manhle.vn@gmail.com>
Committer
LE Manh Cuong <cuong.manhle.vn@gmail.com>
Date

Message

Some improvements

 - Adding documentation
 - Note the effect empty array
 - Fix spelling
 - Using new test `[[...]]`

Diff

 1diff --git a/README.markdown b/README.markdown
 2index 9d7210f778e190c035c968acae350fc26cef4192..0d3144ddeb42d519463566c66cec9970739816c2 100644
 3--- a/README.markdown
 4+++ b/README.markdown
 5@@ -88,6 +88,14 @@ If you're feeling feisty, you can let the computer select one randomly for you e
 6 ZSH_THEME="random" # (...please let it be pie... please be some pie..)
 7 ```
 8 
 9+And if you want to pick random theme from a list of your favorite themes:
10+
11+```shell
12+ZSH_THEM_RANDOM_CANDIDATES=(
13+  "robbyrussell"
14+  "agnoster"
15+)
16+```
17 
18 ## Advanced Topics
19 
20diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
21index 0324543d55703f35339842ca4c00ccfa52402938..4517a2ba0492acd904b4f1a581aece85e41a2510 100644
22--- a/oh-my-zsh.sh
23+++ b/oh-my-zsh.sh
24@@ -93,9 +93,9 @@ done
25 unset config_file
26 
27 # Load the theme
28-if [ "$ZSH_THEME" = "random" ]; then
29-  if [ "${(t)ZSH_THEME_RANDOM_CANDICATES}" = "array" ] && [ "${#ZSH_THEME_RANDOM_CANDICATES[@]}" -gt 0 ]; then
30-    themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDICATES}.zsh-theme)
31+if [[ "$ZSH_THEME" == "random" ]]; then
32+  if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
33+    themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
34   else
35     themes=($ZSH/themes/*zsh-theme)
36   fi
37diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
38index baedf0675c26d37a8946d32efc628395ad9569c0..2f39308a9308c447cbca76d67c285c0f70e2a7b8 100644
39--- a/templates/zshrc.zsh-template
40+++ b/templates/zshrc.zsh-template
41@@ -11,7 +11,8 @@ ZSH_THEME="robbyrussell"
42 # Setting this variable when ZSH_THEME=random
43 # cause zsh load theme from this variable instead of
44 # looking in ~/.oh-my-zsh/themes/
45-# ZSH_THEME_RANDOM_CANDICATES=()
46+# An empty array have no effect
47+# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
48 
49 # Uncomment the following line to use case-sensitive completion.
50 # CASE_SENSITIVE="true"