-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
56 lines (50 loc) · 1.58 KB
/
.zshrc
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
# Add autocomplete functionality before everything else.
# Solution: https://github.com/kubernetes/kubectl/issues/125#issuecomment-351653836
autoload -U +X compinit
compinit
autoload -U +X bashcompinit
bashcompinit
# If facing issues on macOS, run the following command...
# compaudit | xargs chmod g-w
# These environment variables are used in other ZSH configuration files.
export NICK_SRC=$HOME/src
export NICK_DOTFILES=$NICK_SRC/dotfiles
export NICK_ARCH="$(uname -m)"
# Set OS-based environment variables.
if [ "$(uname -s)" = "Darwin" ]; then
export NICK_OS="darwin"
export NICK_LINUX="false"
export NICK_WSL2="false"
elif [ "$(uname -s)" = "Linux" ]; then
NICK_LINUX="true"
if [ -f /etc/os-release ]; then
. /etc/os-release
export NICK_OS="$ID"
else
export NICK_OS="unknown"
fi
if [ -f /proc/sys/kernel/osrelease ] && [ $(grep "WSL2" /proc/sys/kernel/osrelease) ]; then
export NICK_WSL2="true"
else
export NICK_WSL2="false"
fi
else
export NICK_OS="unknown"
export NICK_LINUX="false"
export NICK_WSL2="false"
fi
function nick-environment-variables {
echo "NICK_ARCH $NICK_ARCH"
echo "NICK_OS $NICK_OS"
echo "NICK_LINUX $NICK_LINUX"
echo "NICK_WSL2 $NICK_WSL2"
echo "NICK_SRC $NICK_SRC"
echo "NICK_DOTFILES $NICK_DOTFILES"
}
for ZSH_CONFIG_FILE in $NICK_DOTFILES/zsh/*; do
if [ -r $ZSH_CONFIG_FILE ]; then
source $ZSH_CONFIG_FILE
else
echo "file not readable or not found: $ZSH_CONFIG_FILE"
fi
done