This repository has been archived by the owner on Dec 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bashrc
105 lines (93 loc) · 2.86 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
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
# Colors
# (via https://wiki.archlinux.org/index.php/Color_Bash_Prompt)
# -----------------------------------------------------------------------------
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background
bakred='\e[41m' # Red
bakgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
bakblu='\e[44m' # Blue
bakpur='\e[45m' # Purple
bakcyn='\e[46m' # Cyan
bakwht='\e[47m' # White
txtrst='\e[0m' # Text Reset
# Bash completion
# -----------------------------------------------------------------------------
if [ $(which brew) ] && [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
elif [ -d /usr/local/etc/bash_completion.d ]; then
source /usr/local/etc/bash_completion.d/*
fi
# Prompt
# -----------------------------------------------------------------------------
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_DESCRIBE_STYLE="branch"
GIT_PS1_SHOWUPSTREAM="auto git"
function generate_PS1() {
local extv=$?
local user="\[$txtgrn\]\u\[$txtrst\]"
local host="\[$txtcyn\]\H\[$txtrst\]"
local path="\[$txtred\]\w\[$txtrst\]"
local branch="\[$txtylw\]$('__git_ps1' " %s")\[$txtrst\]"
local sep="·"
PS1="[$user $host $path$branch]\n($extv): "
}
export PROMPT_COMMAND=generate_PS1
# Environment
# -----------------------------------------------------------------------------
# Ensure color when listing directory contents
if [ `uname` == Linux ]; then
LSCOLOR='--color=auto'
elif [ `uname` == Darwin ]; then
LSCOLOR='-G'
fi
# Remember a lot of history
HISTFILESIZE=10000
export TERM=screen-256color
export ANSIBLE_HOSTS=./production
export GOPATH=$HOME
# Aliases
# -----------------------------------------------------------------------------
alias ls="ls $LSCOLOR"
alias ll='ls -la'
alias vi='vim'
alias v='vim .'
alias grep='grep --color'
alias tmux='tmux -2'
alias pubkey='cat ~/.ssh/id_rsa.pub'
# Utilities
# -----------------------------------------------------------------------------
grepf() {
tail -f $1 | grep --line-buffered $2;
}
# Source env-specific stuff
# -----------------------------------------------------------------------------
if [ -d ~/.bashrc.d ]; then
for RC in `ls ~/.bashrc.d/*.sh`; do . $RC; done
fi