diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 2a79e180d..0d5634dfc 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="stibbons" diff --git a/themes/dlintw.zsh-theme b/themes/dlintw.zsh-theme new file mode 100644 index 000000000..8f02627c5 --- /dev/null +++ b/themes/dlintw.zsh-theme @@ -0,0 +1,35 @@ +# Based on cypher and 's prompt http://blog.mired.org/2011/02/adding-vcs-to-zshs-vcsinfo.html +# @author Daniel YC Lin +# Shows the exit status of the last command if non-zero +# Uses "#" instead of "$" when running as root + +# ref: http://linux-sxs.org/housekeeping/lscolors.html +# and http://geoff.greer.fm/lscolors/ +export LS_COLORS='di=1;34;47:ln=1;35:so=32;40:pi=33;40:ex=1;31:bd=31;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' + +# set variable debian_chroot if running in a chroot with /etc/debian_chroot +if [[ -z "$debian_chroot" ]] && [[ -r /etc/debian_chroot ]]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +p_chroot="${debian_chroot:+[$debian_chroot]}" +p_time="%K{black}%B%F{yellow}%D{%H:%M:%S}%k" +p_ret="%(0?.. %F{red}%? )" +p_ps="%B%F{blue}%(#.#.$)%b " +PROMPT="$p_chroot$p_time$p_ret$p_ps%{$reset_color%}" + +autoload -Uz vcs_info +zstyle ':vcs_info:*' enable fossil hg svn git cvs # p4 off, but must be last. +precmd () { vcs_info } + +zstyle ':vcs_info:*' get-revision true +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' formats '%u%c|%s:%b' +zstyle ':vcs_info:*' actionformats '%c%u|%s@%a:%b' +zstyle ':vcs_info:*' branchformat '%b@%r' +#zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' unstagedstr "%{$fg_no_bold[red]%}" +zstyle ':vcs_info:*' stagedstr "%{$fg_no_bold[yellow]%}" + +RPROMPT='%F{green}%n@%m %F{magenta}%3~$%{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' +setopt PROMPT_SUBST diff --git a/tools/list_theme.sh b/tools/list_theme.sh new file mode 100755 index 000000000..dec57dd49 --- /dev/null +++ b/tools/list_theme.sh @@ -0,0 +1,41 @@ +#!/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 '%D' $f && echo -n "date " + 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 '%2~' $f && echo -n "path2 " + grep -q '%3~' $f && echo -n "path3 " + grep -q 'precmd' $f && echo -n "precmd " + grep -q 'RPROMPT' $f && echo -n "rprompt " + 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 'VCS' $f && echo -n "vcs " + grep -q 'vcs_info' $f && echo -n "vcs_info " + grep -q 'vcs_info_msg' $f && echo -n "vcs_info_msg " + echo "" +done +# vim:et sw=2 ts=2 ai