Created
December 17, 2015 21:06
-
-
Save spencerhakim/489964462d64e0476790 to your computer and use it in GitHub Desktop.
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
function __better_git_ps1 { | |
local GIT_PS1=`__git_ps1 "%s"` | |
set -f | |
local GIT_PS1_ARR=($GIT_PS1) | |
set +f | |
if [ "$GIT_PS1" ]; then | |
if [ ${#GIT_PS1_ARR[0]} -ge 20 ]; then | |
GIT_PS1=`printf "%.20s... %s" \ | |
"${GIT_PS1_ARR[0]}" \ | |
"${GIT_PS1_ARR[1]}"` | |
fi | |
printf "{%s} " "$GIT_PS1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment