Last active
June 17, 2016 10:33
-
-
Save pounard/13c11740cda826eb50d4fe33dd4f13f8 to your computer and use it in GitHub Desktop.
My PS1 (for bash) needs to be fixed a bit
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
#!/bin/bash | |
# Inspired from (very far away) | |
# http://code-worrier.com/blog/git-branch-in-bash-prompt/ | |
# https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh | |
# | |
# I needed something simpler, and I work on slow FS so let it be minimal. | |
__git_br() { | |
local ingit="" | |
# Thanks, https://stackoverflow.com/a/2180367 | |
if [ -f "$PWD/.git" ]; then | |
ingit="1" | |
else | |
ingit="`git rev-parse --git-dir 2> /dev/null`" | |
fi | |
if [ ! -z $ingit ]; then | |
echo -n "`git branch --no-color | grep "*" | cut -d " " -f 2`" | |
fi | |
} | |
RZ=$'\e[0m' # Reset everything | |
FG_BOR=$'\033[01;38;5;208m' # Foreground orange bold | |
FG_BWH=$'\033[01;38;5;7m' # Foreground not so white bold | |
FG_BRD=$'\033[31m' # Foreground red bold | |
BG_DGG=$'\e[0;40m' # Background dark gray | |
export PS1="[\${FG_BOR}\u@\h${RZ}] ${FG_BWH}\w ${FG_BRD}\$(__git_br)${RZ}\n\${BG_DGG} > ${RZ} " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment