-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
bashrc
194 lines (151 loc) Β· 5.94 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
## This file is sourced by all *interactive* bash shells on startup. This
## file *should generate no output* or it will break the scp and rcp commands.
############################################################
if [ -e /etc/bashrc ] ; then
. /etc/bashrc
fi
# Suppress MacOS warnign about zsh
export BASH_SILENCE_DEPRECATION_WARNING=1
############################################################
## MANPATH
############################################################
function conditionally_prefix_manpath {
local dir=$1
if [ -d $dir ]; then
MANPATH="$dir:${MANPATH}"
fi
}
conditionally_prefix_manpath /usr/local/man
conditionally_prefix_manpath ~/man
############################################################
## SYSTEM PATH
############################################################
function conditionally_prefix_path {
local dir=$1
if [ -d $dir ]; then
PATH="$dir:${PATH}"
fi
}
conditionally_prefix_path /usr/local/bin
conditionally_prefix_path /usr/local/sbin
conditionally_prefix_path /usr/texbin
############################################################
## HOMEBREW
############################################################
if [ -f /opt/homebrew/bin/brew ] && [ `uname -m` == "arm64" ]; then
eval $(/opt/homebrew/bin/brew shellenv)
conditionally_prefix_path /opt/homebrew/opt/python/libexec/bin
elif [ -f /usr/local/bin/brew ]; then
eval $(/usr/local/bin/brew shellenv)
conditionally_prefix_path /usr/local/opt/python/libexec/bin
fi
export PATH="$PATH:$(go env GOPATH)/bin"
source "$(brew --prefix)/share/google-cloud-sdk/path.bash.inc"
############################################################
## LOCAL PATH
############################################################
conditionally_prefix_path ~/bin
conditionally_prefix_path ~/bin/private
conditionally_prefix_path ~/.nodenv/bin
if [ `which rbenv 2> /dev/null` ]; then
eval "$(rbenv init -)"
fi
if [ `which nodenv 2> /dev/null` ]; then
eval "$(nodenv init -)"
fi
PATH=.:./bin:./node_modules/.bin:${PATH}
############################################################
## Other paths
############################################################
function conditionally_prefix_cdpath {
local dir=$1
if [ -d $dir ]; then
CDPATH="$dir:${CDPATH}"
fi
}
conditionally_prefix_cdpath ~/work
conditionally_prefix_cdpath ~/work/oss
CDPATH=.:${CDPATH}
# Set INFOPATH so it includes users' private info if it exists
# if [ -d ~/info ]; then
# INFOPATH="~/info:${INFOPATH}"
# fi
############################################################
## General development configurations
###########################################################
export RBXOPT=-X19
############################################################
## Terminal behavior
############################################################
if [ -f ~/.bash_powerline ]; then
. ~/.bash_powerline
fi
# if [ -n "$BASH" ]; then
# export PS1='\[\033[32m\]\n[\s: \w] (β¬₯ $(ruby_prompt)) (β¬’ $(node_prompt)) $(git_prompt)\n\[\033[31m\][\u@\h]\$ \[\033[00m\]'
# fi
############################################################
## Optional shell behavior
############################################################
shopt -s cdspell
shopt -s extglob
shopt -s checkwinsize
export PAGER="less"
export EDITOR="emacsclient -nw"
############################################################
## History
############################################################
# When you exit a shell, the history from that session is appended to
# ~/.bash_history. Without this, you might very well lose the history of entire
# sessions (weird that this is not enabled by default).
shopt -s histappend
export HISTIGNORE="&:pwd:ls:ll:lal:[bf]g:exit:rm*:sudo rm*"
# remove duplicates from the history (when a new item is added)
export HISTCONTROL=erasedups
# increase the default size from only 1,000 items
export HISTSIZE=10000
export HISTFILESIZE=1000000
############################################################
## Aliases
############################################################
if [ -e ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
############################################################
## Bash Completion, if available
############################################################
if [ -f /opt/homebrew/etc/bash_completion ] && [ `uname -m` == "arm64" ]; then
. /opt/homebrew/etc/bash_completion
elif [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
elif [ -f /etc/profile.d/bash_completion ]; then
. /etc/profile.d/bash_completion
elif [ -f ~/.bash_completion ]; then
# Fallback. This should be sourced by the above scripts.
. ~/.bash_completion
fi
# tabtab source for serverless package
# uninstall by removing these lines or running `tabtab uninstall serverless`
[ -f /Users/rmcgeary/.config/yarn/global/node_modules/tabtab/.completions/serverless.bash ] && . /Users/rmcgeary/.config/yarn/global/node_modules/tabtab/.completions/serverless.bash
# tabtab source for sls package
# uninstall by removing these lines or running `tabtab uninstall sls`
[ -f /Users/rmcgeary/.config/yarn/global/node_modules/tabtab/.completions/sls.bash ] && . /Users/rmcgeary/.config/yarn/global/node_modules/tabtab/.completions/sls.bash
############################################################
## Other
############################################################
if [[ "$USER" == '' ]]; then
# mainly for cygwin terminals. set USER env var if not already set
USER=$USERNAME
fi
# Make sure this appears even after rbenv, git-prompt and other shell extensions
# that manipulate the prompt.
if [ `which direnv 2> /dev/null` ]; then
eval "$(direnv hook bash)"
fi
############################################################
## Ruby Performance Boost (see https://gist.github.com/1688857)
############################################################
# export RUBY_GC_MALLOC_LIMIT=60000000
# # export RUBY_FREE_MIN=200000 # Ruby <= 2.0
# export RUBY_GC_HEAP_FREE_SLOTS=200000 # Ruby >= 2.1