-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bash_profile
40 lines (31 loc) · 919 Bytes
/
.bash_profile
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
export CLICOLOR=1
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk '{print " ("$1")" }'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
function gl {
grep --color=always -r "$*" . | grep --color=always -v \.svn | less -R
}
alias ls="ls --color"
PROMPT_COMMAND=__prompt_command # Func to gen PS1 after CMDs
__prompt_command() {
local EXIT="$?" # This needs to be first
PS1="\u"
local RCol='\[\e[0m\]'
local Red='\[\e[0;31m\]'
local Gre='\[\e[0;32m\]'
local BYel='\[\e[1;33m\]'
local BBlu='\[\e[1;34m\]'
local Pur='\[\e[0;35m\]'
if [ $EXIT != 0 ]; then
PS1+="${Red}@${RCol}" # Add red if exit code non 0
else
PS1+="${Gre}@${RCol}"
fi
PS1+="\h:$(PWD)\\$\[$(tput sgr0)\] "
}