Skip to content

Commit 1fe0819

Browse files
edmundmillerclaude
andcommitted
fix(zsh): Fix configuration conflicts and znap plugin loading
- Fix zsh-snap package SHA256 hash for proper Nix building - Add missing helper functions (_source, _cache) to generated .zshrc - Add conditional checks for zoxide and autopair-init to prevent errors - Fix completion initialization with -i flag for insecure directories - Add p10k config loading support - Remove reference to missing rc.extra.zsh file - Add Pixi PATH export to config/.zshrc for compatibility Resolves conflicts between Nix-managed and manual zsh configurations, ensuring all plugins load correctly and shell functions are available. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 29c3b14 commit 1fe0819

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

config/zsh/.zshrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env zsh
22
# This sources the actual zshrc from the dotfiles
33
# The real configuration is in ~/.config/zsh/.zshrc
4-
[[ -f "$ZDOTDIR/.zshrc" ]] && source "$ZDOTDIR/.zshrc"
4+
[[ -f "$ZDOTDIR/.zshrc" ]] && source "$ZDOTDIR/.zshrc"
5+
6+
export PATH="/Users/emiller/.pixi/bin:$PATH"

modules/shell/zsh.nix

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let
5555
owner = "marlonrichert";
5656
repo = "zsh-snap";
5757
rev = "25754a45d9ceafe6d7d082c9ebe40a08cb85a4f0"; # Latest commit as of Dec 2024
58-
sha256 = "0by6k6skc3wlmc5s56pz7i89z6n0i3yrgm0lw4r7aqx5manlvp60";
58+
sha256 = "sha256-iunAF4hXQ5vC5u3nXPB+q1xLWaFsYKcbsGijrDHGVQo=";
5959
};
6060

6161
installPhase = ''
@@ -108,14 +108,33 @@ in
108108
export ZDOTDIR="''${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}"
109109
export ZSH_CACHE="''${ZSH_CACHE:-$XDG_CACHE_HOME/zsh}"
110110
111+
# Helper functions
112+
function _source {
113+
[[ -f "$1" ]] && source "$1"
114+
}
115+
116+
function _cache {
117+
local cache_dir="$XDG_CACHE_HOME/zsh"
118+
local cache_file="$cache_dir/$1.zsh"
119+
120+
if [[ ! -f "$cache_file" ]] || [[ "$commands[$1]" -nt "$cache_file" ]]; then
121+
mkdir -p "$cache_dir"
122+
"$@" > "$cache_file"
123+
fi
124+
source "$cache_file"
125+
}
126+
111127
# Source configuration
112128
source $ZDOTDIR/config.zsh
113129
114130
${znapInit}
115131
132+
# Load p10k config if it exists
133+
[[ -f $ZDOTDIR/.p10k.zsh ]] && source $ZDOTDIR/.p10k.zsh
134+
116135
## Bootstrap interactive sessions
117136
if [[ $TERM != dumb ]]; then
118-
autoload -Uz compinit && compinit -u -d $ZSH_CACHE/zcompdump
137+
autoload -Uz compinit && compinit -i -u -d $ZSH_CACHE/zcompdump
119138
120139
source $ZDOTDIR/keybinds.zsh
121140
source $ZDOTDIR/completion.zsh
@@ -127,10 +146,14 @@ in
127146
_source $ZDOTDIR/local.zshrc
128147
129148
# Initialize zoxide with caching
130-
_cache zoxide init zsh
149+
if (( $+commands[zoxide] )); then
150+
_cache zoxide init zsh
151+
fi
131152
132153
# Initialize autopair
133-
autopair-init
154+
if (( $+functions[autopair-init] )); then
155+
autopair-init
156+
fi
134157
fi
135158
'';
136159
};
@@ -271,6 +294,6 @@ in
271294
dclo = "docker-compose logs -f";
272295
};
273296

274-
modules.shell.zsh.rcFiles = [ "${configDir}/zsh/rc.extra.zsh" ];
297+
modules.shell.zsh.rcFiles = [ ];
275298
};
276299
}

0 commit comments

Comments
 (0)