If the svn plugin is used, svn info (repo name and wether the repo is dirty) is displayed in the prompt like with git. Just lke with git, the colors can be manipulated with variables (see awesomepanda theme for example).
Robin Ramael authored on 10/01/2011 at 17:18:311 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
0 |
+function svn_prompt_info { |
|
1 |
+ if [[ -d .svn ]]; then |
|
2 |
+ echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ |
|
3 |
+$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" |
|
4 |
+ fi |
|
5 |
+} |
|
6 |
+ |
|
7 |
+ |
|
8 |
+function in_svn() { |
|
9 |
+ if [[ -d .svn ]]; then |
|
10 |
+ echo 1 |
|
11 |
+ fi |
|
12 |
+} |
|
13 |
+ |
|
14 |
+function svn_get_repo_name { |
|
15 |
+ if [ is_svn ]; then |
|
16 |
+ svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT |
|
17 |
+ |
|
18 |
+ svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" |
|
19 |
+ fi |
|
20 |
+} |
|
21 |
+ |
|
22 |
+function svn_get_rev_nr { |
|
23 |
+ if [ is_svn ]; then |
|
24 |
+ svn info 2> /dev/null | sed -n s/Revision:\ //p |
|
25 |
+ fi |
|
26 |
+} |
|
27 |
+ |
|
28 |
+function svn_dirty_choose { |
|
29 |
+ if [ is_svn ]; then |
|
30 |
+ s=$(svn status 2>/dev/null) |
|
31 |
+ if [ $s ]; then |
|
32 |
+ echo $1 |
|
33 |
+ else |
|
34 |
+ echo $2 |
|
35 |
+ fi |
|
36 |
+ fi |
|
37 |
+} |
|
38 |
+ |
|
39 |
+function svn_dirty { |
|
40 |
+ svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN |
|
41 |
+} |
|
0 | 42 |
\ No newline at end of file |
1 | 43 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
0 |
+# the svn plugin has to be activated for this to work. |
|
1 |
+ |
|
2 |
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' |
|
3 |
+ |
|
4 |
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" |
|
5 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
|
6 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" |
|
7 |
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " |
|
8 |
+ |
|
9 |
+ |
|
10 |
+ |
|
11 |
+ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" |
|
12 |
+ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" |
|
13 |
+ |
|
14 |
+ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" |
|
15 |
+ZSH_THEME_SVN_PROMPT_SUFFIX=")" |
|
16 |
+ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" |
|
17 |
+ZSH_THEME_SVN_PROMPT_CLEAN=" " |
|
0 | 18 |
\ No newline at end of file |