-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile
115 lines (78 loc) · 2.63 KB
/
bash_profile
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
#!/bin/bash
# shellcheck source=/dev/null
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
source_bash_files() {
declare -r -a FILES_TO_SOURCE=(
"bash_aliases"
"bash_autocomplete"
"bash_exports"
"bash_functions"
"bash_options"
# "bash_prompt" Note: Using starship prompt instead (see: https://starship.rs).
"keybindings"
)
local file=""
local i=""
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
for i in ${!FILES_TO_SOURCE[*]}; do
file="$HOME/.config/bash/bash/${FILES_TO_SOURCE[$i]}"
[[ -r "$file" ]] &&
. "$file"
done
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
source_bash_files
unset -f source_bash_files
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Check to see if the Mac needs Rosetta installed by testing the processor
processor=$(/usr/sbin/sysctl -n machdep.cpu.brand_string | grep -o "Apple")
if [[ -n $processor ]]; then
# 'brew' configurations
eval "$(/opt/homebrew/bin/brew shellenv)"
else
# 'brew' configurations
eval "$(/usr/local/bin/brew shellenv)"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# load 'bash-sensible' configs.
# see: https://github.com/mrzool/bash-sensible
if [[ -d "$HOME"/.config/bash/bash-sensible ]]; then
. "$HOME"/.config/bash/bash-sensible/sensible.bash
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# load 'fzf' configs.
# see: https://github.com/junegunn/fzf#using-homebrew-or-linuxbrew
[[ -f ~/.fzf.bash ]] && source ~/.fzf.bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# load 'z.lua' configs.
# see: https://github.com/skywind3000/z.lua#install
if [[ -d "$HOME"/.z.lua ]]; then
eval "$(lua "$HOME"/.z.lua/z.lua --init bash)"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# load starship prompt
# see: https://starship.rs
eval "$(starship init bash)"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# load nord theme
# see: https://github.com/lemnos/theme.sh
if command -v theme &>/dev/null; then
theme nord
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# start tmux on start up of bash
# see: https://unix.stackexchange.com/a/260248
#if test -z "$TMUX"; then
# session_num=$(
# tmux list-sessions |
# grep -v attached |
# grep -oE '^\d+:' |
# grep -oE '^\d+' |
# head -1
# )
# if test "$session_num"; then
# exec tmux attach -t "$session_num"
# else
# exec tmux
# fi
#fi