Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
0c28e392
Commit
0c28e392
authored
Nov 01, 2017
by
Robby Russell
Browse files
Merge branch 'Gnouc-Random_Theme_From_List'
parents
57742ccd
a1d13aa0
Changes
3
Show whitespace changes
Inline
Side-by-side
README.md
View file @
0c28e392
...
@@ -96,6 +96,14 @@ If you're feeling feisty, you can let the computer select one randomly for you e
...
@@ -96,6 +96,14 @@ If you're feeling feisty, you can let the computer select one randomly for you e
ZSH_THEME
=
"random"
# (...please let it be pie... please be some pie..)
ZSH_THEME
=
"random"
# (...please let it be pie... please be some pie..)
```
```
And if you want to pick random theme from a list of your favorite themes:
```
shell
ZSH_THEM_RANDOM_CANDIDATES
=(
"robbyrussell"
"agnoster"
)
```
## Advanced Topics
## Advanced Topics
...
...
oh-my-zsh.sh
View file @
0c28e392
...
@@ -93,8 +93,12 @@ done
...
@@ -93,8 +93,12 @@ done
unset
config_file
unset
config_file
# Load the theme
# Load the theme
if
[
"
$ZSH_THEME
"
=
"random"
]
;
then
if
[[
"
$ZSH_THEME
"
==
"random"
]]
;
then
if
[[
"
${
(t)ZSH_THEME_RANDOM_CANDIDATES
}
"
=
"array"
]]
&&
[[
"
${#
ZSH_THEME_RANDOM_CANDIDATES
[@]
}
"
-gt
0
]]
;
then
themes
=(
$ZSH
/themes/
${
^ZSH_THEME_RANDOM_CANDIDATES
}
.zsh-theme
)
else
themes
=(
$ZSH
/themes/
*
zsh-theme
)
themes
=(
$ZSH
/themes/
*
zsh-theme
)
fi
N
=
${#
themes
[@]
}
N
=
${#
themes
[@]
}
((
N
=(
RANDOM%N
)
+1
))
((
N
=(
RANDOM%N
)
+1
))
RANDOM_THEME
=
${
themes
[
$N
]
}
RANDOM_THEME
=
${
themes
[
$N
]
}
...
...
templates/zshrc.zsh-template
View file @
0c28e392
...
@@ -9,6 +9,13 @@ export ZSH=$HOME/.oh-my-zsh
...
@@ -9,6 +9,13 @@ export ZSH=$HOME/.oh-my-zsh
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
ZSH_THEME="robbyrussell"
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# CASE_SENSITIVE="true"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment