From 69b4decc08468de062a0e6f9738a14a8c2ed8499 Mon Sep 17 00:00:00 2001 From: Daniel YC Lin Date: Tue, 6 Aug 2013 17:03:21 +0800 Subject: [PATCH] show themes featues by grep --- templates/zshrc.zsh-template | 2 +- tools/list_theme.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 tools/list_theme.sh diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 1dfb6998c..0cef52062 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -2,7 +2,7 @@ ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. -# Look in ~/.oh-my-zsh/themes/ +# Look in ~/.oh-my-zsh/themes/ (show features by tools/list_theme.sh) # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. ZSH_THEME="robbyrussell" diff --git a/tools/list_theme.sh b/tools/list_theme.sh new file mode 100755 index 000000000..20faa2d8d --- /dev/null +++ b/tools/list_theme.sh @@ -0,0 +1,34 @@ +#!/bin/zsh +# list_theme is list the feature which theme provides +# usage: list_theme.sh [theme_dir] +# @author Daniel YC Lin +# +# eg. +# list_theme.sh | tee list +# cat list | grep git | grep tty # filter what you want +# . theme/foo.zsh-theme # try the theme +# copy foo.zsh-theme bar.zsh-theme my_theme +# list_theme.sh my_theme # just list themes in a directory + +THEMES_DIR="${1:-$HOME/.oh-my-zsh/themes}" +for f in $THEMES_DIR/*.zsh-theme ; do + echo -n "$(basename $f .zsh-theme) " + grep -q '%?' $f && echo -n "code " + grep -q 'GIT' $f && echo -n "git " + grep -q '%!' $f && echo -n "hist " + grep -q '%h' $f && echo -n "hist " + grep -q '%m' $f && echo -n "host " + grep -q '%H' $f && echo -n "hour " + grep -q '%j' $f && echo -n "job " + grep -q '%L' $f && echo -n "level " + grep -q '%y' $f && echo -n "line " + grep -q '%M' $f && echo -n "machine " + grep -q '%~' $f && echo -n "path " + grep -q '%S' $f && echo -n "sec " + grep -q 'SVN' $f && echo -n "svn " + grep -q '%l' $f && echo -n "tty " + grep -q '%n' $f && echo -n "user " + grep -q '%D' $f && echo -n "date " + echo "" +done +# vim:et sw=2 ts=2 ai