Commit 7cfcf08f authored by Cédric Marie's avatar Cédric Marie

bash/init: Add git prompt support

Add git prompt support with __git_ps1 function.
NB: On Fedora, the function must be explicitly loaded.
Signed-off-by: default avatarCédric Marie <cedric@hjuvi.lautre.net>
parent 3ce58e31
......@@ -23,9 +23,13 @@ fi
# Define aliases
source $PAINTED_SHELL_PATH/bash/alias
# Load git prompt support (__git_ps1) on Fedora
if [ -f /usr/share/git-core/contrib/completion/git-prompt.sh ]; then
source /usr/share/git-core/contrib/completion/git-prompt.sh
fi
# Set colorful prompt
if [ "$TERM" != "" ]; then
PS1="\[\e[1;37;43m\]\t\[\e[0m\] \[\e[1;36;44m\]\w\[\e[0m\]\[\e[1;31m\] >\[\e[0m\] "
PS1='\[\e[1;37;43m\]\t\[\e[0m\] \[\e[1;36;44m\]\w\[\e[0;32;40m\]$(__git_ps1)\[\e[0m\]\[\e[1;31m\] >\[\e[0m\] '
fi
# Add the path to scripts if not yet present
echo $PATH | grep -q "$PAINTED_SHELL_PATH/scripts" || PATH=$PATH:$PAINTED_SHELL_PATH/scripts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment