Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Random theme selection from favourite list #651

Closed
wants to merge 2 commits into from

2 participants

@volpino

As discussed in #482 i wrote this simple patch.
The only thing you've to modify your zshrc adding something like:

export ZSH_THEME="random"
export ZSH_FAVLIST="/home/fox/.zsh_favlist"

then omz will pick random themes from the favlist ;)
Maybe it could be done better but i'm not a zsh ninja

I added the q/quit stuff too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 3 deletions.
  1. +12 −1 oh-my-zsh.sh
  2. +4 −2 tools/theme_chooser.sh
View
13 oh-my-zsh.sh
@@ -43,7 +43,18 @@ for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
# Load the theme
if [ "$ZSH_THEME" = "random" ]
then
- themes=($ZSH/themes/*zsh-theme)
+ if [ -z $ZSH_FAVLIST ]
+ then
+ themes=($ZSH/themes/*zsh-theme)
+ else
+ content=(`cat $ZSH_FAVLIST`)
+ i=1
+ for theme in $content
+ do
+ themes[$i]=$ZSH/themes/$theme.zsh-theme
+ ((i=i+1))
+ done
+ fi
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
View
6 tools/theme_chooser.sh
@@ -12,8 +12,10 @@ FAVLIST="${HOME}/.zsh_favlist"
source $ZSH/oh-my-zsh.sh
function noyes() {
- read "a?$1 [y/N] "
- if [[ $a == "N" || $a == "n" || $a = "" ]]; then
+ read "a?$1 [y/N/q] "
+ if [[ $a == "q" || $a == "quit" ]] then
+ exit 0
+ elif [[ $a == "N" || $a == "n" || $a = "" ]]; then
return 0
fi
return 1
Something went wrong with that request. Please try again.