themes.plugin.zsh 653 B

1234567891011121314151617181920212223242526
  1. function theme
  2. {
  3. if [ -z "$1" ] || [ "$1" = "random" ]; then
  4. themes=($ZSH/themes/*zsh-theme)
  5. N=${#themes[@]}
  6. ((N=(RANDOM%N)+1))
  7. RANDOM_THEME=${themes[$N]}
  8. source "$RANDOM_THEME"
  9. echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
  10. else
  11. if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]
  12. then
  13. source "$ZSH_CUSTOM/themes/$1.zsh-theme"
  14. else
  15. source "$ZSH/themes/$1.zsh-theme"
  16. fi
  17. fi
  18. }
  19. function lstheme
  20. {
  21. # Resources:
  22. # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
  23. # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
  24. print -l {$ZSH,$ZSH_CUSTOM}/themes/*.zsh-theme(N:t:r)
  25. }