Skip to content

Instantly share code, notes, and snippets.

@tamirble
Created November 24, 2018 20:51
Show Gist options
  • Save tamirble/866ad1ac86f64bae2282a4feb04c67fc to your computer and use it in GitHub Desktop.
Save tamirble/866ad1ac86f64bae2282a4feb04c67fc to your computer and use it in GitHub Desktop.
bash_profile with nice emojies and git branches
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
get_emoji() {
if [ "${exit_code}" -eq "0" ]; then
printf 😌
else
printf 😅
fi
}
PROMPT_COMMAND=__prompt_command
__prompt_command() {
local exit_code=${?}
emoji=$(get_emoji exit_code)
PS1="[\w]\[\033[32m\]\$(parse_git_branch)\[\033[00m\] ${emoji} $ "
}
alias ls="ls -G"
alias ll="ls -la"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment