Last active
December 10, 2015 05:08
-
-
Save plainprogrammer/4385788 to your computer and use it in GitHub Desktop.
Custom BASH prompt including username, working directory, git branch and status on one line; followed by a simple prompt that reflects the exit status of the last command.
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
source /usr/local/etc/bash_completion.d/git-prompt.sh | |
function parse_git_dirty { | |
local retval=$? | |
[[ $(git status 2> /dev/null | tail -n1) != "" && $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*" | |
return $retval | |
} | |
function parse_git_branch { | |
local retval=$? | |
echo -e "$(__git_ps1)" | |
return $retval | |
} | |
export PS1="\n\u: \w [\[\033[1;35m\]\$(~/.rvm/bin/rvm-prompt i v g)\[\033[0m\]]\[\e[01;36m\]\$(parse_git_branch)\[\e[01;33m\]\$(parse_git_dirty)\n\`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]\xE2\x9C\x94'; else echo -e '\[\e[01;31m\]\xE2\x9C\x98'; fi\`\[\e[00m\] " | |
export PS2="\`echo -e '\xE2\x9E\x94'\` " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment