mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
theme-admin: Add support for pre-selecting random themes in a basic way.
This commit is contained in:
parent
3913106b2e
commit
20ab45218c
3 changed files with 25 additions and 2 deletions
|
|
@ -1,10 +1,19 @@
|
|||
function theme
|
||||
{
|
||||
if [ -z "$1" ] || [ "$1" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
if [ -f "$THEMES_FILE" ]; then
|
||||
echo "[oh-my-zsh] Found custom theme file $THEMES_FILE"
|
||||
themes=($(<$THEMES_FILE))
|
||||
alias oh-my-zsh-theme-remove='echo "Removing theme ${themes[$N]}" ; sed -i.old "/$(basename ${themes[$N]})/d" $THEMES_FILE'
|
||||
else
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
fi
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
RANDOM_THEME=${themes[$N]}
|
||||
if [ -f "$THEMES_FILE" ]; then
|
||||
RANDOM_THEME="$ZSH/themes/$RANDOM_THEME"
|
||||
fi
|
||||
source "$RANDOM_THEME"
|
||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue