File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,18 @@ function git_prompt_info() {
5
5
}
6
6
7
7
parse_git_dirty () {
8
- if [[ $(( git status 2 > / dev/ null) | tail - n1 ) != "nothing to commit (working directory clean)" ]]; then
9
- echo "$ZSH_THEME_GIT_PROMPT_DIRTY "
10
- else
11
- echo "$ZSH_THEME_GIT_PROMPT_CLEAN "
8
+ gitstat=$( git status 2> /dev/null | grep ' \(# Untracked\|# Changes\|# Changed but not updated:\)' )
9
+
10
+ if [[ $( echo ${gitstat} | grep -c " ^# Changes to be committed:$" ) > 0 ]]; then
11
+ echo -n " $ZSH_THEME_GIT_PROMPT_DIRTY "
12
+ fi
13
+
14
+ if [[ $( echo ${gitstat} | grep -c " ^\(# Untracked files:\|# Changed but not updated:\)$" ) > 0 ]]; then
15
+ echo -n " $ZSH_THEME_GIT_PROMPT_UNTRACKED "
16
+ fi
17
+
18
+ if [[ $( echo ${gitstat} | wc -l | tr -d ' ' ) == 0 ]]; then
19
+ echo -n " $ZSH_THEME_GIT_PROMPT_CLEAN "
12
20
fi
13
21
}
14
22
Original file line number Diff line number Diff line change @@ -33,4 +33,5 @@ RPROMPT='$(battery_charge)'
33
33
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg [magenta]%}"
34
34
ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$reset_color %}"
35
35
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg [green]%}!"
36
+ ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$fg [green]%}?"
36
37
ZSH_THEME_GIT_PROMPT_CLEAN=" "
You can’t perform that action at this time.
0 commit comments