Add zsh/oh my zsh/w10k
This commit is contained in:
18
zsh/.oh-my-zsh/plugins/themes/README.md
Normal file
18
zsh/.oh-my-zsh/plugins/themes/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Themes Plugin
|
||||
|
||||
This plugin allows you to change ZSH theme on the go.
|
||||
|
||||
To use it, add `themes` to the plugins array in your zshrc file:
|
||||
|
||||
```
|
||||
plugins=(... themes)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`theme <theme_name>` - Changes the ZSH theme to specified theme.
|
||||
|
||||
`theme ` - Changes the ZSH theme to some random theme.
|
||||
|
||||
`lstheme ` - Lists installed ZSH themes.
|
||||
|
3
zsh/.oh-my-zsh/plugins/themes/_theme
Normal file
3
zsh/.oh-my-zsh/plugins/themes/_theme
Normal file
@ -0,0 +1,3 @@
|
||||
#compdef theme
|
||||
|
||||
_arguments "1: :($(lstheme | tr "\n" " "))"
|
26
zsh/.oh-my-zsh/plugins/themes/themes.plugin.zsh
Normal file
26
zsh/.oh-my-zsh/plugins/themes/themes.plugin.zsh
Normal file
@ -0,0 +1,26 @@
|
||||
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..."
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user