Created
July 3, 2015 05:14
-
-
Save ggaaooppeenngg/2953f7e14d9edbcb9630 to your computer and use it in GitHub Desktop.
.bashrc
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
get_git_branch(){ | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null); then | |
printf '%s\n' "${branch^^}" # if on bash 3.2, you may need to use tr instead | |
else | |
echo "NORMAL" | |
fi | |
} | |
exit_status(){ | |
if (( ${1:-$?} == 0 )); then | |
printf '%s' '。:.゚ヽ(*´∀`)ノ゚.:。' | |
else | |
printf '%s' '・゜・(PД`q。)・゜' | |
fi | |
} | |
build_prompt() { | |
last_exit_status_=$? | |
PS1='[\w]\d\t\$\n\[$(tput bold)\]\[\033[38;5;82m\]\u\[$(tput sgr0)\]\[$(tput bold)\]->\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;11m\]($(get_git_branch))\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;87m\]$(exit_status "$last_exit_status_")\[$(tput sgr0)\]:' | |
} | |
PROMPT_COMMAND=build_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment