From 0709ec91252f2ff1f8b138beb1a5cebae23d1e46 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 1 Jan 2011 20:14:07 -0500 Subject: [PATCH 1/2] adding a subversion lib module --- lib/svn.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/svn.zsh diff --git a/lib/svn.zsh b/lib/svn.zsh new file mode 100644 index 000000000..54d23b45c --- /dev/null +++ b/lib/svn.zsh @@ -0,0 +1,16 @@ +# utility functions for subversion +# based on oh-my-zsh git lib module + +function svn_dirty { + if [[ -n $(svn status) ]]; then + echo "$ZSH_THEME_SVN_PROMPT_DIRTY" + else + echo "$ZSH_THEME_SVN_PROMPT_CLEAN" + fi +} + +function svn_prompt_info { + info=$(svn info 2>/dev/null) || return + rev=$(echo "$info" | grep Revision | sed 's/Revision: //') + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}r${rev}$(svn_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" +} From 70b3820bce34d17dceec10de197a7810912745e5 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 1 Jan 2011 20:15:27 -0500 Subject: [PATCH 2/2] a multiline theme with version control info for SVN and Git --- themes/xcolour.zsh-theme | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 themes/xcolour.zsh-theme diff --git a/themes/xcolour.zsh-theme b/themes/xcolour.zsh-theme new file mode 100644 index 000000000..13e36e3cf --- /dev/null +++ b/themes/xcolour.zsh-theme @@ -0,0 +1,21 @@ +# Matt Singleton's oh-my-zsh theme + +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + svn info >/dev/null 2>/dev/null && echo 'ϟ' && return + echo '$' +} + +PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%} +$(git_prompt_info)$(svn_prompt_info)$(prompt_char) %{$reset_color%}' +RPROMPT='%D{%r}' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}" + +ZSH_THEME_SVN_PROMPT_PREFIX="(" +ZSH_THEME_SVN_PROMPT_SUFFIX=") " +ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}" +ZSH_THEME_SVN_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}"