-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.functions
47 lines (40 loc) · 1.24 KB
/
.functions
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
#!/bin/bash
# Load NVM
[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh"
# Podman aliased as Docker if latter not installed
if ! type docker &> /dev/null; then
export DOCKER_HOST="unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')"
alias docker="podman"
fi
detect-dark-mode() {
interfaceStyle=`defaults read -g AppleInterfaceStyle 2>/dev/null`
if [ "$interfaceStyle" = "Dark" ]; then
export BACKGROUND=dark
else
export BACKGROUND=light
fi
if [ "$TERM" = 'xterm-kitty' ]; then
case $BACKGROUND in
"light")
kitty @ set-colors -a -c "$HOME/.config/kitty/base16/colors/base16-tomorrow-256.conf"
;;
"dark")
kitty @ set-colors -a -c "$HOME/.config/kitty/base16/colors/base16-tomorrow-night-eighties-256.conf"
;;
esac
fi
}
load-nvmrc() {
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
nvm use
fi
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}