mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-04 15:07:23 +01:00
10 lines
381 B
Bash
10 lines
381 B
Bash
# modify the prompt to contain git branch name if applicable
|
|
git_prompt_info() {
|
|
current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
|
if [[ -n $current_branch ]]; then
|
|
echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}"
|
|
fi
|
|
}
|
|
setopt promptsubst
|
|
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
|