Update theme to support fine grained git status
Robby Russell authored on 23/07/2011 at 16:15:42... | ... |
@@ -3,8 +3,22 @@ |
3 | 3 |
|
4 | 4 |
local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" |
5 | 5 |
|
6 |
-PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' |
|
6 |
+function my_git_prompt_info() { |
|
7 |
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
|
8 |
+ GIT_STATUS=$(git_prompt_status) |
|
9 |
+ [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" |
|
10 |
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" |
|
11 |
+} |
|
12 |
+ |
|
13 |
+PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(my_git_prompt_info)%{$reset_color%}%B»%b ' |
|
7 | 14 |
RPS1="${return_code}" |
8 | 15 |
|
9 | 16 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" |
10 | 17 |
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" |
18 |
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" |
|
19 |
+ZSH_THEME_GIT_PROMPT_ADDED="+" |
|
20 |
+ZSH_THEME_GIT_PROMPT_MODIFIED="*" |
|
21 |
+ZSH_THEME_GIT_PROMPT_RENAMED="~" |
|
22 |
+ZSH_THEME_GIT_PROMPT_DELETED="!" |
|
23 |
+ZSH_THEME_GIT_PROMPT_UNMERGED="?" |
|
24 |
+ |