-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbash_profile.linux
More file actions
56 lines (48 loc) · 2.04 KB
/
Copy pathbash_profile.linux
File metadata and controls
56 lines (48 loc) · 2.04 KB
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
function find_git_branch {
local dir=. head
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head == ref:\ refs/heads/* ]]; then
git_branch="${head#*/*/} "
elif [[ $head != '' ]]; then
git_branch='(detached) '
else
git_branch='(unknown) '
fi
return
fi
dir="../$dir"
done
git_branch=''
}
function munge_path {
munged_path=`ruby -e "y='$PWD'.sub('$HOME','~');x='';p=y.split('/');x+='.../' if p.length > 4; x+=p[[0,p.length-4].max,p.length].join('/');x+='/' if p.length==0;if x.length < y.length then print x; else print y; end;"`
}
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
export LS_COLORS='no=00:fi=00:di=00;32:ln=00;36:pi=01;36:so=00;34:bd=33;01:cd=33;01:or=31;01:ex=00;33:*.tar=01;37:*.tgz=01;37:*.arj=01;37:*.taz=01;37:*.lzh=01;37:*.zip=01;37:*.z=01;37:*.Z=01;37:*.gz=01;37:*.deb=01;37:*.rpm=01;37:*.bz2=01;37:*.jpg=01;32:*.gif=01;32:*.png=01;32:*.bmp=01;32:*.ppm=01;32:*.tga=01;32:*.xbm=01;32:*.xpm=01;32:*.tif=01;32:*.mpg=01;32:*.avi=01;32:*.gl=01;32:*.dl=01;35:*.cc=01;32:*.cpp=01;32:*.py=01;32:*.java=01;32:*.h=00;32:*.c=01;32:*.o=00;37:*.pyc=00;37'
# colors found at http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
RS="\[\033[0m\]" # reset
BOLD="\[\033[38;5;220m\]"
if [ "$USER" != "lehresman" ] && [ "$USER" != "lehresma" ]; then
FG="\[\033[38;5;160m\]"
else
FG="\[\033[38;5;238m\]"
fi
PS1="${FG}[${BOLD}\$git_branch${FG}\u@\h \$munged_path]\$${RS} "
PROMPT_COMMAND="munge_path; find_git_branch; $PROMPT_COMMAND"
export PATH=$HOME/bin:$PATH
export FIGNORE=".svn"
unset LANG
export LC_ALL=POSIX
export LESS=-S
alias ls="ls --color -F"
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.bash_custom" ]] && source "$HOME/.bash_custom"