all repos — dot @ master

Shell, editor and terminal configuration, and the tools that go with them

config/zprofile (view raw)

 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
# ~/.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