Skip to content

Instantly share code, notes, and snippets.

@gpaton
Last active December 22, 2015 07:29
Show Gist options
  • Save gpaton/6438173 to your computer and use it in GitHub Desktop.
Save gpaton/6438173 to your computer and use it in GitHub Desktop.
Modifie le prompt pour afficher le logo Apple à la place du nom de l'utilisateur.Affiche aussi la branche en cours si on est dans un repo git
# Auto-complétion Git
source ~/.git-completion.bash
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Alias
source ~/.alias
source ~/.bash_export
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
prompt() {
last_status="$?"
color_base="\[\e[0m\]"
color_red_bold="\[\e[1;31m\]"
color_green_bold="\[\e[1;32m\]"
color_yellow_light="\[\e[0;33m\]"
git_branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
# Last command failed
if [ $last_status -eq "0" ]
then
smiley="${color_green_bold}  ${color_base}"
else
smiley="${color_red_bold}  ${color_base}"
fi
if [ -z "$git_branch" ]
then
git="";
else
git="${color_yellow_light}${git_branch}${color_base} "
fi
PS1="${smiley}${git}$PWD ${color_yellow_light}ᐅ ${color_base}"
PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")'
}
PROMPT_COMMAND=prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment