Looking at the actual machine turned up something the shared plugin list could not express. The Mac loads macos, brew and dotbare; beastix and shron load archlinux. One list filtered by availability - which is what the stub did - would have dropped four plugins on the Mac without a word. Assembly moves into 05-pre-omz.zsh, which knows the role, and the availability filter stays on top of it so a plugin that is not installed still cannot produce a warning at every login. .zprofile is added, and that is the whole point of the mobile role. The Mac sets its PATH in .zshrc, so /opt/homebrew/bin exists for interactive shells and for nothing else: "ssh mac brew --version" comes back empty, which during the design phase was read as Homebrew not being installed. It is installed, with 178 formulae. Homebrew's shellenv belongs in .zprofile and now lives there; the loop is inert on Linux, where neither prefix exists. Carried over from the Mac: the Homebrew auto-update settings and bench(), which runs bench inside the ERPNext compose stack. PYTHONPATH pointed at /usr/lib/python3.9/site-packages there too - a Linux path on macOS, so doubly wrong. All three machines had a variant of that line and none of them is kept. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
53 lines
2.0 KiB
Bash
53 lines
2.0 KiB
Bash
# Everything that has to be set before oh-my-zsh is sourced, and nothing else.
|
|
#
|
|
# oh-my-zsh reads the theme and its own settings while being sourced, so any of
|
|
# these placed in a role file - which comes afterwards - is silently ignored.
|
|
# The first attempt put ZSH_THEME in the role file and produced a shell that
|
|
# reported the right value while running without powerlevel10k at all.
|
|
#
|
|
# The role COLOUR is deliberately NOT here. ~/.p10k.zsh assigns
|
|
# POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced later from
|
|
# 30-path.zsh, so a colour set here is overwritten before the first prompt is
|
|
# drawn. It belongs in the role files, which run after that.
|
|
|
|
if [[ -d "${ZSH_CUSTOM:-$ZSH/custom}/themes/powerlevel10k" ]]; then
|
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
|
elif [[ "$ROLE" == "server" ]]; then
|
|
# What shron already used. Without this it would silently fall back to
|
|
# oh-my-zsh's default, which is a change nobody asked for.
|
|
ZSH_THEME="ys"
|
|
fi
|
|
|
|
case "$ROLE" in
|
|
server)
|
|
# A server should not decide on its own to go fetching updates while
|
|
# someone is logged in trying to fix something.
|
|
DISABLE_AUTO_UPDATE="true"
|
|
;;
|
|
*)
|
|
zstyle ':omz:update' mode auto
|
|
;;
|
|
esac
|
|
|
|
# Plugins. Assembled here rather than in the stub because the set is
|
|
# role-dependent: macos, brew and dotbare exist only on the Mac, archlinux only
|
|
# where pacman does. A single shared list would have silently dropped four
|
|
# plugins on the Mac.
|
|
#
|
|
# Filtered by what is actually present. Naming a plugin that is not installed
|
|
# makes oh-my-zsh complain on every shell start, and the local custom plugin
|
|
# signal-keyring is exactly that case on any machine other than beastix.
|
|
_want=(git colored-man-pages colorize zsh-interactive-cd fzf)
|
|
case "$ROLE" in
|
|
desktop|server) _want+=(archlinux) ;;
|
|
mobile) _want+=(macos brew dotbare) ;;
|
|
esac
|
|
|
|
plugins=()
|
|
for _p in $_want; do
|
|
if [[ -d "$ZSH/plugins/$_p" || -d "${ZSH_CUSTOM:-$ZSH/custom}/plugins/$_p" ]]; then
|
|
plugins+=("$_p")
|
|
fi
|
|
done
|
|
unset _p _want
|