Showing 1 changed files with 6 additions and 2 deletions
+6 -2
.zsh/prompt
... ...
@@ -75,12 +75,16 @@ precmd () {
75 75
     elif [ $nbrj -gt 0 ]; then 
76 76
         __PROMPT__+="\e[1;34m$nbrj\e[0;34m job en cours\n"
77 77
     fi
78
-    __PROMPT__+="$(git_prompt_string)"
78
+    local GIT_PROMPT_STRING="$(git_prompt_string)"
79
+    if [ -n "$GIT_PROMPT_STRING" ]; then
80
+        local GIT_REPO_DIR="$(git rev-parse --show-toplevel 2> /dev/null)"
81
+    fi
82
+    __PROMPT__+="$GIT_PROMPT_STRING"
79 83
     if test $SHLVL -eq 1 -o $TERM != "screen"; then
80 84
         __PROMPT__+="\e[1;33m$HOST\e[0m:"
81 85
     fi
82 86
     __PROMPT__+="\e[0;32m$([[ $UID == 0 ]] && echo '\e[47m\e[4;31m /!\ root /!\ \e[0m\e[0;31m ')"
83
-    __PROMPT__+="$(pwd)\e[0m"
87
+    __PROMPT__+="${PWD/$GIT_REPO_DIR/${bg[green]}${fg[black]}$GIT_REPO_DIR\e[0m${fg[green]}}\e[0m"
84 88
     echo -e "$__PROMPT__"
85 89
 }
86 90