fix(zsh): init zoxide after Oh My Posh to keep its hook#31
Merged
Conversation
Oh My Posh rewrites the zsh hook array on init. With zoxide sourced
before the prompt (tools.zsh at step 8, prompt.zsh at step 10), Oh My
Posh displaced zoxide's precmd/chpwd hook, tripping `zoxide doctor`
("initialize zoxide at the end").
Reorder index.zsh so tools.zsh (fzf, zoxide) sources after prompt.zsh,
keeping zoxide's hook intact. No package added/removed - status blocks
unchanged. Rationale documented inline at step 10.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fnayou
added a commit
that referenced
this pull request
Jun 24, 2026
PR #31 moved fzf init into tools.zsh (sourced last, after the prompt) so zoxide could initialise at end. But fzf's `fzf --zsh` registers completions via compdef and must run before completions.zsh, so sourcing it last produced a silent completion error. Split fzf into its own fzf.zsh, sourced after compinit (plugins.zsh) and before completions.zsh (step 5b). zoxide stays in tools.zsh at the end where Oh My Posh's hook rewrite no longer displaces it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
zoxide doctorwarned on every new shell:Root cause
index.zshowns source order. zoxide was initialised intools.zsh(step 8), before Oh My Posh inprompt.zsh(step 10). Oh My Posh rewrites the zsh hook array on init, displacing zoxide'sprecmd/chpwdhook — which is exactly what the doctor check detects.Fix
Reorder
index.zshsotools.zsh(fzf, zoxide) sources afterprompt.zsh. zoxide now registers its hook last and survives. Rationale documented inline at the new step 10.zoxide init --cmd cdmode preserved.Verification
Fresh interactive zsh after the change:
zoxide doctorwarning: gonechpwd_functionscontains__zoxide_hookprecmd_functionscontains_omp_precmd(Oh My Posh inits before zoxide)