-
Notifications
You must be signed in to change notification settings - Fork 2
/
bashrc
170 lines (135 loc) · 3.75 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
### -*- shell-script -*-
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export CVS_RSH=ssh
export HISTIGNORE="&:mutt:[bf]g:exit"
export INPUTRC=${HOME}/.inputrc
export PAGER=less
export LESS="XR"
export PERL5LIB=${HOME}/lib/perl5
export PYTHONPATH=${HOME}/lib/python
export RUBYOPT=rubygems
export RI="-f ansi"
CDPATH=".:~:${HOME}/src:${HOME}/Documents"
if [ ! -z "$TERM" ] && [ "$TERM" != 'dumb' ]; then
# from The (Almost) Perfect Backspace Solution
stty erase "$(tput kbs)"
_parse_branch () {
type git >& /dev/null || return
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
### prompt fanciness
_prompt () {
local GREEN="\[\033[0;32m\]"
local MAGENTA="\[\033[0;35m\]"
local RED="\[\033[0;31m\]"
local YELLOW="\[\033[0;33m\]"
local NOCOLOR="\[\033[0m\]"
local HOST_COLOR=$RED
local SSH_IP=$(echo $SSH_CLIENT | awk '{ print $1 }')
if [ "$SSH_IP" ]; then
HOST_COLOR=$MAGENTA
fi
echo "${GREEN}[${NOCOLOR}\!${GREEN}]${NOCOLOR}" \
"${GREEN}{${NOCOLOR}\t${GREEN}}${NOCOLOR}" \
"${YELLOW}<${NOCOLOR}\u@${HOST_COLOR}\h${NOCOLOR}:\w${YELLOW}>" \
"${GREEN}\$(_parse_branch)${NOCOLOR}\n\$ "
}
export PS1=$(_prompt)
export PS2='-> '
fi
set -o emacs
set -o ignoreeof
shopt -s cdspell
shopt -s checkwinsize
shopt -s cmdhist histappend histreedit histverify lithist
shopt -s extglob
shopt -s progcomp
alias la="ls -a"
alias ll="ls -l"
alias cl="clear"
alias h="history"
alias jobs="jobs -l"
alias mv="mv -i"
alias rm="rm -i"
alias g="git"
alias be="bundle exec"
alias ag="ag --pager=\${PAGER:-less}"
alias e="emacsclient --no-wait"
alias v="nvim"
alias vi="nvim"
alias vrc="nvim ~/.config/nvim/init.vim"
alias tmux="tmux -2"
alias t="todo.sh"
alias G="nvim +G"
alias x="exa --git"
# use color if grep supports it...
if grep --help 2>&1 | grep -- --color &> /dev/null; then
alias grep='grep --color=auto'
fi
##OS specific configuration
case $OSTYPE in
darwin*)
export CLICOLOR='on' # color ls
export COMMAND_MODE='unix2003' # no legacy mode on leopard
alias top="top -u"
;;
esac
if [ -x "$HOME/bin/e" ]; then
export EDITOR=$HOME/bin/e
# Use terminal mode by default if we're on a remove host.
if [ ! -z "${SSH_CLIENT}" ]; then
export EDITOR="${EDITOR} -t"
fi
fi
if [ -r ~/.bash_functions ]; then
source ~/.bash_functions
fi
## setup bash completions if we can find it.
for f in {,/usr/local}/etc/bash_completion; do
if [ -r $f ]; then
. $f
break
fi
done
unset f
complete -C aws_completer aws
if [ -s "$HOME/.bash_local" ]; then
source "$HOME/.bash_local"
fi
if type rbenv >& /dev/null; then
eval "$(rbenv init -)"
fi
if type virtualenvwrapper.sh >& /dev/null; then
source virtualenvwrapper.sh
fi
if [ -x "${HOME}/.chefvm/bin/chefvm" ]; then
eval "$(${HOME}/.chefvm/bin/chefvm init -)"
fi
if [ -x "${HOME}/.cask/bin/cask" ]; then
export PATH="${HOME}/.cask/bin:$PATH"
fi
if [ -d "${HOME}/src/go" ]; then
export GOPATH="${HOME}/src/go"
export PATH="${PATH}:${GOPATH}/bin"
fi
if type stack >& /dev/null; then
eval "$(stack --bash-completion-script "$(which stack)")"
export PATH="${HOME}/.local/bin:${PATH}"
fi
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
if which pyenv-virtualenv-init > /dev/null; then
eval "$(pyenv virtualenv-init -)"
fi
if [ -e "${HOME}/.nvm/nvm.sh" ]; then
. ${HOME}/.nvm/nvm.sh 2>/dev/null
fi
[ -f ${HOME}/.travis/travis.sh ] && source ${HOME}/.travis/travis.sh
if [ -d ${HOME}/.cargo/bin ]; then
export PATH="${PATH}:${HOME}/.cargo/bin"
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash