-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc.mac
177 lines (143 loc) · 4.43 KB
/
bashrc.mac
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
# vim: ft=sh:
#
# references:
# http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
# http://ss64.com/osx/
# http://gnu.org/software/bash/manual/bashref.html#Bash-Conditional-Expressions
#
# iTerm2 needs this to show utf-8 correctly
export LC_ALL="en_US.UTF-8"
# PATH setup bonanza
PATH="/usr/local/bin:/usr/local/sbin:$PATH:/Users/$USER/Scripts:/Users/$USER/.local/bin"
MANPATH="$MANPATH:/usr/local/man"
export PATH MANPATH
# editor settings
export EDITOR=nvim
export VIM_APP_DIR=~/Code
# set x86_64 flags for my macs
if [[ $OSTYPE == darwin* ]]; then
export CFLAGS="-arch x86_64 -O2"
export ARCHFLAGS="-arch x86_64"
fi
# java-related settings
export JAVA_HOME="$(/usr/libexec/java_home)"
if [ -d /usr/local/opt/go/libexec/bin ]; then
export PATH="/usr/local/opt/openjdk/bin:$PATH"
fi
# go-related settings
if [ -d /usr/local/opt/go/libexec/bin ]; then
export GOPATH=/usr/local/opt/go/libexec/bin
export PATH=$PATH:/usr/local/opt/go/libexec/bin
fi
# node settings
if [ -d /usr/local/lib/node_modules ]; then
export NODE_PATH=/usr/local/lib/node_modules
fi
if [ -d ~/.cargo ]; then
source "$HOME/.cargo/env"
fi
# flutter settings
# if [ -x /usr/local/bin/flutter ]; then
# export FLUTTER_PATH=/usr/local/flutter
# export PATH=$PATH:/usr/local/flutter/bin
# export PATH="$PATH:`pwd`/flutter/bin"
# fi
# heroku toolbelt
if [ -d /usr/local/heroku ]; then
export PATH="/usr/local/heroku/bin:$PATH"
fi
# google-cloud-sdk bootstrap
if [ -d /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk ]; then
export CLOUDSDK_PYTHON="/usr/local/opt/[email protected]/libexec/bin/python"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"
fi
# bootstrap asdf (multi-lang version control)
# https://github.com/asdf-vm/asdf
ASDF_SCRIPT=$HOME/.asdf/asdf.sh
if [ -f $ASDF_SCRIPT ]; then
source $ASDF_SCRIPT
fi
ASDF_COMPLETION=$HOME/.asdf/completions/asdf.bash
if [ -f $ASDF_COMPLETION ]; then
source $ASDF_COMPLETION
fi
export CLICOLOR=1
export HISTCONTROL=ignoredups
export HISTCONTROL=ignoreboth
# amazon web services
if [ -e /usr/local/bin/aws ]; then
# aws-cli autocomplete
complete -C aws_completer aws
fi
# git prompt pimpin'
if [ -e /usr/local/etc/bash_completion.d/git-prompt.sh ]; then
source /usr/local/etc/bash_completion.d/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
fi
# bash options
shopt -s checkwinsize
shopt -s cdspell
shopt -s globstar
shopt -s nocaseglob
shopt -s extglob
shopt -s autocd
shopt -u mailwarn
unset MAILCHECK
# setup bash completion
if [ -s /usr/local/etc/bash_completion ]; then
source /usr/local/etc/bash_completion || echo 'bash completions unavaliable.'
fi
# bootstrap python if avaliable
if [ -s ~/.pyenv/shims ]; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# setting pipenv up
if [ -x "$(which pipenv)" ]; then
eval "$(pip completion --bash)"
else
read -p 'pipenv not found. Install? [y/N]: ' install_pipenv
if [ "$install_pipenv" == "y" ] || [ "$install_pipenv" == "Y" ]; then
$(which pip) install pipenv
fi
fi
# "private" helper functions
function __basedir {
basename `pwd`
}
function __highlight_ps1 {
hostname -s
}
function __setup_prompt {
history -a
history -c
history -r
local NO_COLOR="\[\e[0m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local ORANGE="\[\033[0;33m\]"
local YELLOW="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\033[1;34m\]"
local PURPLE="\[\033[1;35m\]"
local MAGENTA="\[\033[1;35m\]"
local CYAN="\[\033[1;36m\]"
local LIGHT_CYAN="\[\033[1;36m\]"
local GRAY="\[\033[1;30m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local WHITE="\[\033[1;37m\]"
local RUBY_PROMPT="${NO_COLOR}${CYAN}[$(__highlight_ps1)]${NO_COLOR} "
local PATH_PROMPT="${NO_COLOR}${PWD/#$HOME/~}${NO_COLOR}"
local GIT_PROMPT="${NO_COLOR}${MAGENTA}$(__git_ps1)${NO_COLOR}"
# setting the bash PS1 prompt to my liking
# example: export PS1="\u@\h: \W \$ "
# PS1='[$(__rbenv_ps1)] \[\033[1;32m\]\u@\h\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\]\[\033[1;36m\]$(__git_ps1)\[\033[0m\]\n\[\033[1;34m\]\$\[\033[0m\] '
PS1="\n${RUBY_PROMPT}${PATH_PROMPT}${GIT_PROMPT}\n\$ "
}
PROMPT_COMMAND=__setup_prompt
#### automated stuff that crufts the pristine config!