diff --git a/bash-git-prompt b/bash-git-prompt index b36ad8a..190c676 100644 --- a/bash-git-prompt +++ b/bash-git-prompt @@ -1,6 +1,6 @@ # Author : Allan Christensen # First Created : 24062025 (DD-MM-YYYY) -# Description : Optimized Bash Git Prompt with Smart Fingerprint Caching +# Description : Bash Git prompt for Linux # License : MIT License # Default to theme 1 if not set @@ -256,16 +256,25 @@ update_git_prompt() { GIT_PS1="$(git_prompt_info)" + # + # PS1 custom for all themes inside a git repository + # + local PS1_CUSTOM='\[\e[0;32m\]\u@\h\[\e[0m\]' + if [[ -n "$GIT_PS1" ]]; then if [[ "$GIT_PROMPT_THEME" == "3" ]]; then - PS1="${GIT_PS1} ${PROMPT_CHAR} " + PS1="${PS1_CUSTOM} ${GIT_PS1} ${PROMPT_CHAR} " elif [[ "$GIT_PROMPT_THEME" == "2" ]]; then - PS1="${GIT_PS1}\[\e[0m\] ${PROMPT_CHAR} " + PS1="${PS1_CUSTOM} ${GIT_PS1}\[\e[0m\] ${PROMPT_CHAR} " else - PS1='\u@\h \['"$GIT_PS1"'\] \[\e[38;5;178m\]\w\[\e[0m\] '"${PROMPT_CHAR} " + PS1="${PS1_CUSTOM} \[${GIT_PS1}\] \[\e[38;5;178m\]\w\[\e[0m\] ${PROMPT_CHAR} " fi + else - PS1='\u@\h:\[\e[38;5;178m\]\w\[\e[0m\] '"${PROMPT_CHAR} " + # + # PS1 cusom for all themes outside a git repository + # + PS1='\[\e[0;32m\]\u@\h\[\e[0m\]:\[\e[38;5;178m\]\w\[\e[0m\] '"${PROMPT_CHAR} " fi }