mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 21:24:34 +00:00
Improve git prompt function
This commit is contained in:
parent
60920444f0
commit
ba0bdefa6f
|
@ -10,16 +10,14 @@ PURPLE="%F{105}"
|
||||||
RESET="%f"
|
RESET="%f"
|
||||||
|
|
||||||
git_prompt() {
|
git_prompt() {
|
||||||
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
|
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
|
||||||
|
echo -n "$ORANGE${ref#refs/heads/}"
|
||||||
if [ ! -z $branch ]; then
|
|
||||||
echo -n "$ORANGE$branch"
|
|
||||||
|
|
||||||
if [ ! -z "$(git status --short)" ]; then
|
if [ ! -z "$(git status --short)" ]; then
|
||||||
echo "$RED+"
|
echo "$RED+"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setopt PROMPT_SUBST
|
setopt PROMPT_SUBST
|
||||||
|
|
||||||
# Primary Prompt
|
# Primary Prompt
|
||||||
|
|
Loading…
Reference in a new issue