diff options
Diffstat (limited to 'config/zprofile')
| -rwxr-xr-x | config/zprofile | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/config/zprofile b/config/zprofile new file mode 100755 index 0000000..ccc3666 --- /dev/null +++ b/config/zprofile @@ -0,0 +1,31 @@ +# ~/.zprofile — read by zsh *login* shells, interactive or not. +# +# This exists for exactly one reason: on macOS, /etc/zprofile runs path_helper, +# and zsh reads it AFTER ~/.zshenv. path_helper rebuilds PATH with the entries +# from /etc/paths and /etc/paths.d at the front and everything that was already +# on PATH appended behind them, so the precedence config/env just established in +# ~/.zshenv gets inverted: /usr/bin ends up ahead of ~/.bin, /opt/homebrew/bin +# and the rest. `vi` stopped opening neovim that way — /usr/bin/vi shadowed the +# wrapper in ~/.bin. +# +# Loading config/env again here, after path_helper, restores the intended order. +# Its PATH helpers move entries that are already present, so the second pass is +# not a no-op; it is also idempotent, so this costs the usual ~4ms and nothing +# else. See the header of config/env. +# +# ~/.zshrc reaches config/env a third time via config/profile, which is what +# used to paper over this for interactive shells only. Login-but-not-interactive +# zsh (`zsh -lc ...`, some ssh invocations) never reads ~/.zshrc, which is why +# the fix belongs here rather than there. +# +# Interactive-only setup does NOT belong in this file: zsh runs it for +# non-interactive login shells too. Put that in config/profile, via ~/.zshrc. + +# shellcheck source=/dev/null +[ -r "$HOME/.env" ] && . "$HOME/.env" + +# The test above may have been false; don't leak a failing status into the +# shell's first prompt. +: + +# vim: filetype=zsh |
