Created
July 2, 2018 20:47
-
-
Save nathanjackson/903e42415b0cb5bb905ff7af4e1cd25b to your computer and use it in GitHub Desktop.
my PS1 variable
This file contains hidden or 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
function git_portion { | |
git status > /dev/null 2> /dev/null | |
if [[ $? -eq 0 ]] | |
then | |
current_branch=$(git rev-parse --abbrev-ref HEAD) | |
modified='\e[92m' | |
git diff --exit-code 2>/dev/null >/dev/null | |
if [[ $? -ne 0 ]] | |
then | |
modified='\e[97m*\e[93m' | |
fi | |
printf ' \e[0m\e[96m(%b%s\e[96m)' $modified $current_branch | |
fi | |
} | |
export PS1='\[\e[96m\][\[\e[97m\]\w$(git_portion)\[\e[96m\]]\n\[\e[97m\]\u@\h \[\e[91m\]\!\[\e[96m\]\$> \[\e[0m\]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment