aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/zsh')
-rw-r--r--dot_config/zsh/dot_zprofile9
-rw-r--r--dot_config/zsh/dot_zshrc21
2 files changed, 6 insertions, 24 deletions
diff --git a/dot_config/zsh/dot_zprofile b/dot_config/zsh/dot_zprofile
index 9150382..cc92558 100644
--- a/dot_config/zsh/dot_zprofile
+++ b/dot_config/zsh/dot_zprofile
@@ -20,13 +20,8 @@ export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_CACHE_HOME="$HOME/.cache"
-# Pull in /etc/profile + /etc/profile.d/*.sh. The Arch zsh package used
-# to ship /etc/zsh/zprofile doing exactly this, but we removed system
-# zsh in favour of nix's zsh, so we replicate it here. This is how
-# flatpak (XDG_DATA_DIRS for app launchers), nix-daemon, locale, etc.
-# inject themselves into login shells. Sourced AFTER our PATH setup so
-# `typeset -U path` keeps nix-profile/bin + ~/.local/bin at the front
-# even if /etc/profile.d snippets try to prepend duplicates.
+# Pull in distro profile snippets for XDG_DATA_DIRS, nix-daemon, locale, etc.
+# Sourced after PATH setup so user-managed bins stay first.
[[ -r /etc/profile ]] && emulate sh -c 'source /etc/profile'
# Home Manager writes host-specific session variables here. Keep this after
diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc
index 113955c..d432e45 100644
--- a/dot_config/zsh/dot_zshrc
+++ b/dot_config/zsh/dot_zshrc
@@ -43,11 +43,7 @@ PROMPT='%B%{$fg[green]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}:%b%{$
# ── Completion ────────────────────────────────────────────────────────────────
fpath=($XDG_DATA_HOME/zsh/completion $fpath)
-# Pull in completions from both nix-installed packages AND the system
-# package manager (pacman on Arch host, apt on Ubuntu VM). nix zsh's
-# default fpath only includes its own nix-store dirs, so without these
-# entries we miss completions for pacman, systemctl, flatpak,
-# docker, kubectl, etc. on the host, and apt/snap on the VM.
+# Pull in completions from the Nix profile and distro packages.
for _d in "$HOME/.nix-profile/share/zsh/site-functions" \
"$HOME/.nix-profile/share/zsh/vendor-completions" \
/usr/share/zsh/site-functions \
@@ -437,13 +433,7 @@ alias gdbr='gdb -ex start --args'
alias copilot='gh copilot --autopilot --enable-all-github-mcp-tools --yolo --resume'
# ── Alias completions ─────────────────────────────────────────────────────────
-# Guard each compdef on the target's completion function actually being
-# loaded; otherwise zsh prints `compdef: unknown command or service: foo`
-# on every login (the binary being present isn't enough — the zsh
-# completion file `_foo` must be in fpath and registered by compinit).
-# Notably triggers on the remote-dev VM where nix-installed packages
-# ship completions into /home/.../share/zsh/site-functions but Ubuntu's
-# system zsh doesn't add that path to fpath by default.
+# Guard compdef calls on registered completion functions.
# Usage: _dot_compdef <target-cmd> <alias>=<target> [<alias>=<target>...]
_dot_compdef() { (( $+_comps[$1] )) && compdef "${@:2}" }
_dot_compdef git g=git
@@ -454,9 +444,7 @@ _dot_compdef lsd l=lsd la=lsd lt=lsd
unfunction _dot_compdef
# ── GPG agent ─────────────────────────────────────────────────────────────────
-# Interactive shells can outlive the login environment that spawned them
-# (notably inside zellij). If they inherited an old forwarded-agent socket,
-# switch back to the machine-local gpg-agent SSH socket.
+# Prefer the machine-local gpg-agent SSH socket.
if [[ -z "$SSH_AUTH_SOCK" || "$SSH_AUTH_SOCK" == /tmp/ssh-* || "$SSH_AUTH_SOCK" == "$HOME/.ssh/agent.sock" ]]; then
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
export SSH_AUTH_SOCK
@@ -490,8 +478,7 @@ _fzf_compgen_path() { fd --hidden --follow --exclude ".git" . "$1" }
_fzf_compgen_dir() { fd --type d --hidden --follow --exclude ".git" . "$1" }
# ── Plugins (must be sourced last) ────────────────────────────────────────────
-# Plugin locations: ~/.nix-profile (Home-Manager) first, Arch system path as
-# fallback for un-bootstrapped states.
+# Plugin locations: Nix profile first, system path second.
_source_first() {
local f
for f in "$@"; do