-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc.local.example
More file actions
39 lines (35 loc) · 1.68 KB
/
Copy path.zshrc.local.example
File metadata and controls
39 lines (35 loc) · 1.68 KB
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
#!/usr/bin/env zsh
# File: ~/.zshrc.local
# Sourced by: ~/.zshrc
# Keep machine-specific stuff here, anything that does not need to be synced.
# For example, not all machines will have Java or HuggingFace installed
# Paths also change based on OS
# Homebrew (cross-platform)
# Load Homebrew from the same dotfiles on different operating systems
# Homebrew / Linuxbrew shellenv (sets PATH/MANPATH/INFOPATH for brew-installed packages)
for brewbin in /home/linuxbrew/.linuxbrew/bin/brew /opt/homebrew/bin/brew /usr/local/bin/brew; do
if [[ -x "$brewbin" ]]; then
eval "$($brewbin shellenv)"
break
fi
done
# NVM
export NVM_DIR="$HOME/.nvm"
# nvm.sh is lazy-loaded here (instead of .zshenv) to keep startup fast
# Stubs source nvm.sh on first invocation, then re-exec the
# real command. Was the biggest startup cost (~150–300ms eager source).
nvm() { unset -f nvm node npm npx 2>/dev/null; . "$NVM_DIR/nvm.sh"; nvm "$@"; }
node() { unset -f nvm node npm npx 2>/dev/null; . "$NVM_DIR/nvm.sh"; node "$@"; }
npm() { unset -f nvm node npm npx 2>/dev/null; . "$NVM_DIR/nvm.sh"; npm "$@"; }
npx() { unset -f nvm node npm npx 2>/dev/null; . "$NVM_DIR/nvm.sh"; npx "$@"; }
# Put default node's bin on PATH so quick `node -v` works without firing the lazy load.
# Resolve the alias chain (default → lts/iron → 20.18.0) so PATH gets a real version dir.
if [[ -s "$NVM_DIR/alias/default" ]]; then
_nvm_default="$(<"$NVM_DIR/alias/default")"
while [[ -s "$NVM_DIR/alias/$_nvm_default" ]]; do
_nvm_default="$(<"$NVM_DIR/alias/$_nvm_default")"
done
[[ -d "$NVM_DIR/versions/node/v$_nvm_default" ]] && \
export PATH="$NVM_DIR/versions/node/v$_nvm_default/bin:$PATH"
unset _nvm_default
fi