diff --git a/.bash.d/bashrc_prompt b/.bash.d/bashrc_prompt index 0e59b1b..1103868 100644 --- a/.bash.d/bashrc_prompt +++ b/.bash.d/bashrc_prompt @@ -87,5 +87,6 @@ # SGR : \e[nm # # -PS1='\[\e[0m\e[36m\][\u@\h:\W$(__git_ps1 " (%s)")\e[36m]$ \[\e[0m\e[37m\]' +#PS1='\[\e[0m\e[36m\][\u@\h:\W$(__git_ps1 " (%s)")\e[36m]$ \[\e[0m\e[37m\]' +PS1='\[\e[0m\e[36m\][\u@\h:\W(\[\e[33m\]$(__git_ps1_branch " (%s)")\[\e[31m\]$(__git_ps1_status " (%s)")\[\e[36m\])]$ \[\e[0m\e[37m\]' PS2='>' diff --git a/.bash.d/bashrc_prompt b/.bash.d/bashrc_prompt index 0e59b1b..1103868 100644 --- a/.bash.d/bashrc_prompt +++ b/.bash.d/bashrc_prompt @@ -87,5 +87,6 @@ # SGR : \e[nm # # -PS1='\[\e[0m\e[36m\][\u@\h:\W$(__git_ps1 " (%s)")\e[36m]$ \[\e[0m\e[37m\]' +#PS1='\[\e[0m\e[36m\][\u@\h:\W$(__git_ps1 " (%s)")\e[36m]$ \[\e[0m\e[37m\]' +PS1='\[\e[0m\e[36m\][\u@\h:\W(\[\e[33m\]$(__git_ps1_branch " (%s)")\[\e[31m\]$(__git_ps1_status " (%s)")\[\e[36m\])]$ \[\e[0m\e[37m\]' PS2='>' diff --git a/.bash.d/git-prompt-simple.sh b/.bash.d/git-prompt-simple.sh index 93b9fed..5be5a3c 100644 --- a/.bash.d/git-prompt-simple.sh +++ b/.bash.d/git-prompt-simple.sh @@ -9,14 +9,15 @@ [[ "$-" != *i* ]] && return echo "[load] ${BASH_SOURCE:-$0}" -__git_ps1() { +__git_ps1_branch() { BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) if [ ! -z $BRANCH ]; then - STATUS= - if [ ! -z "$(git status --short)" ]; then - STATUS=! - fi - echo -n -e "\e[33m(${BRANCH}\e[31m${STATUS}\e[33m)" + echo -n "${BRANCH}" fi } - +__git_ps1_status() { + if [ ! -z "$(git status --short 2> /dev/null)" ]; then + STATUS=! + fi + echo -n "${STATUS}" +}