forked from mgechev/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_prompt
39 lines (33 loc) · 967 Bytes
/
.bash_prompt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi
MAGENTA=$(tput setaf 9)
RED=$(tput setaf 131)
ORANGE=$(tput setaf 172)
GREEN=$(tput setaf 2)
PURPLE=$(tput setaf 141)
WHITE=$(tput setaf 231)
BLUE=$(tput setaf 109)
YELLOW=$(tput setaf 221)
GRAY=$(tput setaf 238)
RESET="\033[m"
export MAGENTA
export RED
export ORANGE
export GREEN
export BLUE
export PURPLE
export WHITE
export YELLOW
export GRAY
export BOLD
export RESET
function parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
export PS1="\[$BLUE\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" \")\[$RED\]\$(parse_git_branch) \[$RESET\]"