summaryrefslogtreecommitdiff
path: root/config/zprofile
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-09-17 19:45:23 +0100
committerIgor Soarez <igor@soarez.org>2026-09-17 19:45:23 +0100
commit13cc065ec014b86369dfe4ad60d1a43fa06fd251 (patch)
tree684690c61b7b59758c2aac132c65b81c86de0608 /config/zprofile
dotfiles
Shell, editor and terminal configuration, the tools that go with them, and szecret, an age-based secret manager whose store lives elsewhere. History restarts here. What came before was not written to be read by anyone else, and carried machine names, addresses and an encrypted secret store; it is kept privately instead. What is left is meant to be safe on any machine, including one whose owner is not me: see CLAUDE.md for the rule it is written to.
Diffstat (limited to 'config/zprofile')
-rwxr-xr-xconfig/zprofile31
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