-
Notifications
You must be signed in to change notification settings - Fork 3
/
.bashrc_git
executable file
·105 lines (85 loc) · 3.23 KB
/
.bashrc_git
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Simotek - my parts of bashrc shared across multiple machines
#
# Usage:
# export CONFIG_DIR=$HOME/src/scripts-config
# source $CONFIG_DIR/.bashrc_git
# load hiset (Multiple History support)
HISET_DIR=$HOME/.config/hiset
source $CONFIG_DIR/hiset.sh
# original HISET prompt for reference
#export PS1="\[$(ppwd)\]\u@\h-\[$(echo $HISET)\]:\w>"
# I almost always want these i my path
export PATH=~/bin:$PATH:/sbin:/usr/sbin
# http://forums.opensuse.org/showthread.php/414983-Color-Man-Pages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[01;32m' # begin underline
# not all the machines i have ssh access to have terminology and hence tybg so roll my own
function my_tybg()
{
echo -n "\033bt\"$1\"\000"
}
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# source colors separatly to tidy it up
source $CONFIG_DIR/.colors
# Various variables you might want for your PS1 prompt instead
Time12h="\T"
Time12a="\@"
PathShort="\w"
PathFull="\W"
NewLine="\n"
Jobs="\j"
# This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
# I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
HOST_COLOR=$PMT_BRed
if [ "$HOSTNAME" == "kappa" ]; then
HOST_COLOR=$PMT_IBlue
fi
if [ "$HOSTNAME" == "ebony" ]; then
HOST_COLOR=$PMT_Yellow
fi
if [ "$HOSTNAME" == "opensuse" ]; then
HOST_COLOR=$PMT_BIRed
fi
if [ "$HOSTNAME" == "nxserver" ]; then
HOST_COLOR=$PMT_ICyan
fi
if [ "$HOSTNAME" == "rpdweb2-dev-sl.codanad.local" ]; then
HOST_COLOR=$PMT_Green
fi
# I made it like a normal prompt and added HISET support
export PS1=$PMT_IGreen'\u'$PMT_Color_Off$PMT_Purple@$PMT_Color_Off$HOST_COLOR'\h'$PMT_Color_Off$PMT_Purple'$(\
if [ -n "$HISET" ]; then \
echo " ['$PMT_ICyan'$HISET'$PMT_Color_Off$PMT_Purple']"; \
fi \
)'$PMT_Color_Off'$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
if [ "$?" -eq "0" ]; then \
# @4 - Clean repository - nothing to commit
echo "'$PMT_Green'"$(__git_ps1 " (%s)"); \
else \
# @5 - Changes to working tree
echo "'$PMT_IRed'"$(__git_ps1 " {%s}"); \
fi) '$PMT_BYellow$PathShort$PMT_Color_Off$PMT_Purple' \$> '$PMT_Color_Off'"; \
else \
# @2 - Prompt when not in GIT repo
echo " '$PMT_Yellow$PathShort$PMT_Color_Off$PMT_Purple' \$> '$PMT_Color_Off'"; \
fi)'
#export PS1="\[\033[01;33m\]$(ifconfig | grep "inet" | grep -v "127.0.0.1" | awk '{print $2}' | awk -F: '{print $2}') \[\033[01;32m\]\u@\h \[\033[01;34m\]\[\033[01;33m\]\w #\[\033[00m\] "
if [ -n "${HOSTTYPE}" ]
then
if [ "${HOSTTYPE}" == "sparc" ] || [ "${HOSTTYPE}" == "sun4" ]
then
export IV=1
else
GIT_PROMPT_THEME=Single_line_simotek
source $CONFIG_DIR/../bash-git-prompt/gitprompt.sh
fi
fi