forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_prompt
42 lines (36 loc) · 1.09 KB
/
.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
39
40
41
42
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
# Screenshot: http://i.imgur.com/s0Blh.png
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="\[\033[1;31m\]"
ORANGE="\[\033[1;33m\]"
GREEN="\[\033[1;32m\]"
PURPLE="\[\033[1;35m\]"
WHITE="\[\033[1;37m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREY="\[\033[0;37m\]"
BOLD=""
RESET="\033[m"
export MAGENTA
export ORANGE
export GREEN
export PURPLE
export WHITE
export BOLD
export RESET
export RED
export YELLOW
export GREY
function parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && echo "*"
}
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
export PS1="\n\[$GREEN\]$(date +%H:%M) \[$YELLOW\]\w \[$RED\]\$(parse_git_branch)\n\[$GREY\]\$ "
export PS2="\[$ORANGE\]→ \[$RESET\]"