diff --git a/.config/zsh/rc.d/05-prompt.zsh b/.config/zsh/rc.d/05-prompt.zsh index 8fd835b..6e9e41d 100644 --- a/.config/zsh/rc.d/05-prompt.zsh +++ b/.config/zsh/rc.d/05-prompt.zsh @@ -1,32 +1,15 @@ -# Prompt. Sourced by the stub BEFORE oh-my-zsh, and that placement is the whole -# point of the file. +# Theme selection. Sourced by the stub BEFORE oh-my-zsh, and that placement is +# the point of the file. # -# oh-my-zsh loads the theme while it is being sourced, and powerlevel10k reads -# its POWERLEVEL9K_* settings when it loads. Anything set afterwards is simply -# ignored - the first attempt put ZSH_THEME in the role file, which is sourced -# after oh-my-zsh, and the result was a shell with no powerlevel10k at all -# while still reporting the right value in ZSH_THEME. +# oh-my-zsh loads the theme while it is being sourced, so ZSH_THEME set +# afterwards is ignored - the first attempt put it in the role file and produced +# a shell reporting the right value while running without powerlevel10k at all. +# +# The role COLOUR is deliberately not here. ~/.p10k.zsh sets +# POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced later, so a colour set +# here is overwritten before the first prompt is ever drawn. It lives in the +# role files, which come after. -# Only claim the theme if it is actually installed, otherwise oh-my-zsh falls -# back to robbyrussell with a complaint. if [[ -d "${ZSH_CUSTOM:-$ZSH/custom}/themes/powerlevel10k" ]]; then ZSH_THEME="powerlevel10k/powerlevel10k" fi - -# Colour by role. Not decoration: shron carries mail, web and cloud, and a -# glance at the prompt should be enough to know which machine the next command -# is about to hit. Same segments everywhere so nothing else has to be relearned. -case "$ROLE" in - server) - typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=red - # Show the host even locally. Noise on a desktop, the one thing worth - # always seeing here. - typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true - ;; - mobile) - typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=green - ;; - *) - typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=blue - ;; -esac diff --git a/.config/zsh/rc.d/10-aliases.zsh b/.config/zsh/rc.d/10-aliases.zsh index ba7922d..1c1a628 100644 --- a/.config/zsh/rc.d/10-aliases.zsh +++ b/.config/zsh/rc.d/10-aliases.zsh @@ -5,6 +5,18 @@ # machine where lsd is not installed - the Mac, for one - and breaking ls is # the sort of thing that makes a shared dotfile repository feel like a mistake. +# The dotfiles repository itself. A bare repo in ~/.cfg with $HOME as its work +# tree, so "config" behaves like git for the configuration and the real git +# stays out of the way in ordinary projects. +# +# config status what has drifted +# config add .zshrc track a change +# config commit -m ... and push as usual +# +# status.showUntrackedFiles=no is set in the repo, otherwise every file in +# $HOME would show up as untracked. +[[ -d "$HOME/.cfg" ]] && alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' + alias vi="nvim" alias ducks="du -cksh * | sort -rn | head" diff --git a/.config/zsh/rc.d/50-desktop.zsh b/.config/zsh/rc.d/50-desktop.zsh index 4753069..fc26543 100644 --- a/.config/zsh/rc.d/50-desktop.zsh +++ b/.config/zsh/rc.d/50-desktop.zsh @@ -38,3 +38,9 @@ for _d in "$HOME/.cargo/bin" "$HOME/.lmstudio/bin"; do done unset _d export PATH + +# Role colour, set here rather than in 05-prompt.zsh because ~/.p10k.zsh +# assigns POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced in 30-path.zsh. +# Anything set before that is silently replaced. Not decoration: shron carries +# mail, web and cloud, and a glance should say which machine this is. +typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=blue diff --git a/.config/zsh/rc.d/50-mobile.zsh b/.config/zsh/rc.d/50-mobile.zsh index 8eb842a..e26fe93 100644 --- a/.config/zsh/rc.d/50-mobile.zsh +++ b/.config/zsh/rc.d/50-mobile.zsh @@ -14,3 +14,9 @@ for _b in /opt/homebrew /usr/local; do fi done unset _b + +# Role colour, set here rather than in 05-prompt.zsh because ~/.p10k.zsh +# assigns POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced in 30-path.zsh. +# Anything set before that is silently replaced. Not decoration: shron carries +# mail, web and cloud, and a glance should say which machine this is. +typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=green diff --git a/.config/zsh/rc.d/50-server.zsh b/.config/zsh/rc.d/50-server.zsh index 63ae574..dba9dd0 100644 --- a/.config/zsh/rc.d/50-server.zsh +++ b/.config/zsh/rc.d/50-server.zsh @@ -4,3 +4,12 @@ # out of the way; anything that assumes a graphical session belongs in # 50-desktop.zsh. +# Role colour, set here rather than in 05-prompt.zsh because ~/.p10k.zsh +# assigns POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced in 30-path.zsh. +# Anything set before that is silently replaced. Not decoration: shron carries +# mail, web and cloud, and a glance should say which machine this is. +typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=red +# Show the host even in a local shell. Noise on a desktop; here it is the one +# thing worth always having in view. +typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true +