-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.zshenv
121 lines (92 loc) · 3.35 KB
/
.zshenv
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
# .zshenv
##################################################
# Ubuntu-Specific Environment Variables
##################################################
# Skip the global compinit (on Ubuntu)
skip_global_compinit=1
# Skip the Ubuntu /etc/update-motd.d “message of the day”
export MOTD_SHOWN=1
##################################################
# Helper Functions
##################################################
# Safely source all readable *.sh files in a directory
source_all() {
local dir="$1"
[[ -d "$dir" ]] || return 0
for f in "$dir"/*.sh; do
[[ -r "$f" ]] && source "$f"
done
}
# Prepend one or more directories to PATH if they exist and are not already in PATH
pathprepend() {
local d
for d in "$@"; do
if [[ -d "$d" && ":$PATH:" != *":$d:"* ]]; then
PATH="$d${PATH:+":$PATH"}"
fi
done
}
##################################################
# Source /etc/profile.d/ scripts (if present)
##################################################
if [[ -d /etc/profile.d ]]; then
source_all "/etc/profile.d"
fi
##################################################
# Source user-specific functions under ~/.dot-config/.shell/fn.sh
##################################################
if [[ -f "$HOME/.dot-config/.shell/fn.sh" ]]; then
source "$HOME/.dot-config/.shell/fn.sh"
fi
##################################################
# Source user-specific scripts under ~/.dot-config/.shell/fn.d/
##################################################
if [[ -d "$HOME/.dot-config/.shell/fn.d" ]]; then
# Then load the rest (excluding ignore.sh if you don’t want it re-sourced)
for f in "$HOME/.dot-config/.shell/fn.d"/*.zsh; do
[[ -r "$f" ]] && source "$f"
done
fi
##################################################
# Source user-specific scripts under ~/.dot-config/.shell/vars.d/
##################################################
if [[ -d "$HOME/.dot-config/.shell/vars.d" ]]; then
# If you specifically need to load ignore.sh first:
if [[ -r "$HOME/.dot-config/.shell/vars.d/ignore.sh" ]]; then
source "$HOME/.dot-config/.shell/vars.d/ignore.sh"
fi
# Then load the rest (excluding ignore.sh if you don’t want it re-sourced)
for f in "$HOME/.dot-config/.shell/vars.d"/*.sh; do
[[ "$f" == *ignore.sh ]] && continue
[[ -r "$f" ]] && source "$f"
done
fi
##################################################
# Ensure XDG_CONFIG_HOME is defined
##################################################
# If XDG_CONFIG_HOME is not set, default to ~/.config
if [[ -z "$XDG_CONFIG_HOME" ]]; then
export XDG_CONFIG_HOME="$HOME/.config"
fi
##################################################
# Other Environment Variables
##################################################
# MichaelAquilina/zsh-autoswitch-virtualenv
export AUTOSWITCH_SILENT=1
# Python custom REPL init
export PYTHONSTARTUP="$HOME/.pythonrc"
##################################################
# PATH Adjustments
##################################################
# Prepend personal bin directories
pathprepend "$HOME/bin" "$HOME/.local/bin"
# If yarn is available, prepend its global bin directory
if command -v yarn >/dev/null 2>&1; then
pathprepend "$(yarn global bin)"
fi
##################################################
# Optional: Source Cargo if it exists
##################################################
if [[ -f "$HOME/.cargo/env" ]]; then
source "$HOME/.cargo/env"
fi