summaryrefslogtreecommitdiff
path: root/plugins/themes/themes.plugin.zsh
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2012-12-02 12:50:40 -0800
committerRobby Russell <robby@planetargon.com>2012-12-02 12:50:40 -0800
commitd19e01b14086319abae80e7624a8192025e88572 (patch)
tree32d1358247b1b832f0515bf53567adfbccb0d3e5 /plugins/themes/themes.plugin.zsh
parent275e7cba8f2d02a650ff723f1c1e200e43a6dabb (diff)
parentf7b1615b7cd6cd2088050a29f43650098eaba514 (diff)
downloadzsh-d19e01b14086319abae80e7624a8192025e88572.tar.gz
zsh-d19e01b14086319abae80e7624a8192025e88572.tar.bz2
zsh-d19e01b14086319abae80e7624a8192025e88572.zip
Merge pull request #1191 from r-darwish/themes-plugin
Themes plugin
Diffstat (limited to 'plugins/themes/themes.plugin.zsh')
-rw-r--r--plugins/themes/themes.plugin.zsh24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh
new file mode 100644
index 000000000..8bab257ea
--- /dev/null
+++ b/plugins/themes/themes.plugin.zsh
@@ -0,0 +1,24 @@
+function theme
+{
+ if [ "$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/$1.zsh-theme" ]
+ then
+ source "$ZSH_CUSTOM/$1.zsh-theme"
+ else
+ source "$ZSH/themes/$1.zsh-theme"
+ fi
+ fi
+}
+
+function lstheme
+{
+ cd $ZSH/themes
+ ls *zsh-theme | sed 's,\.zsh-theme$,,'
+}