-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
103 lines (81 loc) · 2.34 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
function prepend_to_path_if_exists () {
if [ -d "$1" ]; then
case ":$PATH:" in
*":$1:"*) :;; # Already exists
*) export PATH="$1:$PATH";;
esac
fi
}
function source_if_exists () {
if [ -f $1 ]; then
source "$1"
fi
}
function mkcd () {
mkdir -p $1 && cd $1;
}
if [ $(uname) == "Darwin" ]; then
__is_mac=1
__short_hostname=$(scutil --get LocalHostName)
else
__is_mac=0
__short_hostname=$(hostname -s)
fi
# Reset
export PROMPT_COMMAND=
export HISTFILE="$HOME/.bash_history.$__short_hostname"
export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=100000
export HISTFILESIZE=100000
export EDITOR="vim"
export VISUAL="vim"
export LANG=en_US.UTF-8
export LANGUAGE=en
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export TZ="America/New_York"
source_if_exists "$HOME/.bash_aliases"
# Homebrew
if type brew &>/dev/null; then
__brew_prefix=$(brew --prefix)
__brew_openssl_prefix=$(brew --prefix openssl)
# Curl
prepend_to_path_if_exists $__brew_prefix/opt/curl/bin
# Git
prepend_to_path_if_exists $__brew_prefix/opt/git/libexec/git-core
source_if_exists $__brew_prefix/etc/bash_completion.d/git-completion.bash
source_if_exists $__brew_prefix/etc/bash_completion.d/git-prompt.sh
# OpenSSL
if [ -d $__brew_openssl_prefix ]; then
prepend_to_path_if_exists $__brew_openssl_prefix/bin
export LIBRARY_PATH=$LIBRARY_PATH:"$__brew_openssl_prefix/lib/"
# rbenv
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$__brew_openssl_prefix"
fi
else
# Git
source_if_exists /usr/lib/git-core/git-sh-prompt
fi
# Docker
export DOCKER_SCAN_SUGGEST=false
export DOCKER_CLI_HINTS=false
# rbenv
if type rbenv &>/dev/null; then
eval "$(rbenv init -)"
fi
# Visual Studio Code
if type code &>/dev/null; then
export EDITOR="code --wait"
export VISUAL="code --wait"
fi
# zoxide
if type zoxide &>/dev/null; then
export _ZO_RESOLVE_SYMLINKS=1
eval "$(zoxide init bash)"
fi
# Do this almost-last to allow host-specific overrides
source_if_exists "$HOME/.bashrc.$__short_hostname"
# Do this next-to-last to base the prompt on any host-specific overrides
source_if_exists "$HOME/.bash_prompt"
# Do this last-last to ensure that `history -a` is at the end
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND} history -a"