PS1 : add git branch.
This commit is contained in:
parent
9cda3d222a
commit
125ef0af69
|
@ -74,6 +74,12 @@ gg()
|
|||
git clone https://git.voronind.com/voronind/"${1}"
|
||||
}
|
||||
|
||||
# Show current branch.
|
||||
_git_current_branch()
|
||||
{
|
||||
git branch --show-current 2> /dev/null
|
||||
}
|
||||
|
||||
# autocomplete.
|
||||
_completion_loader git &> /dev/null
|
||||
__git_complete gps _git_push &> /dev/null
|
||||
|
|
|
@ -40,8 +40,12 @@ __prompt_command()
|
|||
# add user, host and working dir
|
||||
PS1+="\u@\h "
|
||||
PS1+="\[${color_blue}\]"
|
||||
PS1+="\w"
|
||||
# PS1+="\${PWD}"
|
||||
# PS1+="\w"
|
||||
PS1+="\${PWD}"
|
||||
|
||||
# Add git branch if available.
|
||||
local git_branch="$(_git_current_branch)"
|
||||
[[ "${git_branch}" = "" ]] || PS1+=" ${color_blue}@${git_branch}"
|
||||
|
||||
# set error red
|
||||
if $is_error; then
|
||||
|
|
Reference in a new issue