Обновление ohmyzsh
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
#compdef theme
|
||||
|
||||
_arguments "1: :($(lstheme | tr "\n" " "))"
|
||||
@@ -1,26 +1,35 @@
|
||||
function theme
|
||||
{
|
||||
if [ -z "$1" ] || [ "$1" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
RANDOM_THEME=${themes[$N]}
|
||||
source "$RANDOM_THEME"
|
||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
||||
function theme {
|
||||
: ${1:=random} # Use random theme if none provided
|
||||
|
||||
if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then
|
||||
source "$ZSH_CUSTOM/$1.zsh-theme"
|
||||
elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then
|
||||
source "$ZSH_CUSTOM/themes/$1.zsh-theme"
|
||||
elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then
|
||||
source "$ZSH/themes/$1.zsh-theme"
|
||||
else
|
||||
if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]
|
||||
then
|
||||
source "$ZSH_CUSTOM/themes/$1.zsh-theme"
|
||||
else
|
||||
source "$ZSH/themes/$1.zsh-theme"
|
||||
fi
|
||||
echo "$0: Theme '$1' not found"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function lstheme
|
||||
{
|
||||
function _theme {
|
||||
_arguments "1: :($(lstheme))"
|
||||
}
|
||||
|
||||
compdef _theme theme
|
||||
|
||||
function lstheme {
|
||||
# Resources:
|
||||
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
|
||||
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
|
||||
print -l {$ZSH,$ZSH_CUSTOM}/themes/*.zsh-theme(N:t:r)
|
||||
{
|
||||
# Show themes inside $ZSH_CUSTOM (in any subfolder)
|
||||
# Strip $ZSH_CUSTOM/themes/ and $ZSH_CUSTOM/ from the name, so that it matches
|
||||
# the value that should be written in $ZSH_THEME to load the theme.
|
||||
print -l "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)
|
||||
|
||||
# Show themes inside $ZSH, stripping the head of the path.
|
||||
print -l "$ZSH"/themes/*.zsh-theme(.N:t:r)
|
||||
} | sort -u | fmt -w $COLUMNS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user