-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
executable file
·56 lines (48 loc) · 1.47 KB
/
.bashrc
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
set -o vi
set_prompt() {
# https://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
# 38;5;x = x foreground color
# 48;5;y = y background color
local c_black_on_blue="\[\e[38;5;0;48;5;67m\]"
local c_black_on_purple="\[\e[38;5;0;48;5;97m\]"
local c_black_on_green="\[\e[38;5;0;48;5;70m\]"
local c_black_on_yellow="\[\e[38;5;0;48;5;143m\]"
local c_off="\[\e[m\]"
local working_dir="$c_black_on_blue \w $c_off"
local where_am_i="$c_black_on_purple \u@\h $c_black_on_blue \w $c_off"
local branch_display=""
local branch=$(git symbolic-ref --short HEAD 2>/dev/null)
if [ -n "$branch" ]; then
local c_branch=""
if output=$(git status --porcelain --untracked-files=no) && [ -z "$output" ]; then
# Working directory clean
c_branch="$c_black_on_green"
else
# Uncommitted changes
c_branch="$c_black_on_yellow"
fi
branch_display="$c_branch $branch $c_off"
fi
PS1="$where_am_i$branch_display\n$ "
}
PROMPT_COMMAND=set_prompt
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
alias ls='ls --color=auto'
else
alias ls='ls -G'
fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias rs='rails server -b 0.0.0.0'
alias rc='rails console'
if [ -d "$HOME/.rvm/bin" ]; then
# Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin"
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
fi
if [ -f "$HOME/.workrc" ]; then
. "$HOME/.workrc"
fi