Update themes plugin to support custom themes
function lstheme won't cd to themes directory anymore.
This commit is contained in:
parent
a97e9419c0
commit
87d3aa4228
@ -1,24 +1,28 @@
|
|||||||
function theme
|
function theme
|
||||||
{
|
{
|
||||||
if [ -z "$1" ] || [ "$1" = "random" ]; then
|
if [ -z "$1" ] || [ "$1" = "random" ]; then
|
||||||
themes=($ZSH/themes/*zsh-theme)
|
themes=($ZSH/themes/*.zsh-theme)
|
||||||
N=${#themes[@]}
|
N=${#themes[@]}
|
||||||
((N=(RANDOM%N)+1))
|
((N=(RANDOM%N)+1))
|
||||||
RANDOM_THEME=${themes[$N]}
|
RANDOM_THEME=${themes[$N]}
|
||||||
source "$RANDOM_THEME"
|
source "$RANDOM_THEME"
|
||||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
RANDOM_THEME_NAME=`echo "$RANDOM_THEME"|xargs -d '\n' -n 1 basename|sed 's/\(.*\)\..*/\1/'`
|
||||||
|
echo "[oh-my-zsh] Random theme '$RANDOM_THEME_NAME' loaded."
|
||||||
else
|
else
|
||||||
if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ]
|
if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]; then
|
||||||
then
|
source "$ZSH_CUSTOM/themes/$1.zsh-theme"
|
||||||
source "$ZSH_CUSTOM/$1.zsh-theme"
|
elif [ -f "$ZSH/themes/$1.zsh-theme" ]; then
|
||||||
else
|
source "$ZSH/themes/$1.zsh-theme"
|
||||||
source "$ZSH/themes/$1.zsh-theme"
|
else
|
||||||
fi
|
echo "[oh-my-zsh] Theme '$1' not found."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function lstheme
|
function lstheme
|
||||||
{
|
{
|
||||||
cd $ZSH/themes
|
ls -1 $ZSH/themes/*.zsh-theme $ZSH_CUSTOM/themes/*.zsh-theme \
|
||||||
ls *zsh-theme | sed 's,\.zsh-theme$,,'
|
| xargs -d '\n' -n 1 basename \
|
||||||
|
| sed 's/\(.*\)\..*/\1/' \
|
||||||
|
| uniq | sort | column
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user