themes.plugin.zsh 480 B

123456789101112131415161718192021222324
  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/$1.zsh-theme" ]
  12. then
  13. source "$ZSH_CUSTOM/$1.zsh-theme"
  14. else
  15. source "$ZSH/themes/$1.zsh-theme"
  16. fi
  17. fi
  18. }
  19. function lstheme
  20. {
  21. cd $ZSH/themes
  22. ls *zsh-theme | sed 's,\.zsh-theme$,,'
  23. }