Created
November 24, 2018 20:51
-
-
Save tamirble/866ad1ac86f64bae2282a4feb04c67fc to your computer and use it in GitHub Desktop.
bash_profile with nice emojies and git branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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