Skip to content

fix: move zoxide/fnm after oh-my-posh so prompt hook survives - #1

Open
jpcallanta wants to merge 1 commit into
zentala:mainfrom
jpcallanta:zoxide-ordering
Open

fix: move zoxide/fnm after oh-my-posh so prompt hook survives#1
jpcallanta wants to merge 1 commit into
zentala:mainfrom
jpcallanta:zoxide-ordering

Conversation

@jpcallanta

Copy link
Copy Markdown

zoxide init powershell wraps prompt to run __zoxide_hook on every cd so the DB learns new dirs. oh-my-posh init pwsh replaces prompt outright (saves old, never calls it).

When zoxide was initialized before oh-my-posh, its wrapper got silently overwritten — z/zi still worked via zoxide query but never auto-learned from cd. You had to zoxide add manually.

Fix

Moved zoxide (and fnm, same hook pattern) to after the oh-my-posh block so they wrap the final prompt. No logic changed, just ordering — now prompt = oh-my-poshzoxidefnm.

Test

Added tests/Unit/ProfileOrdering.Tests.ps1 — static file-order checks (zoxide/fnm must be after oh-my-posh init pwsh) + a tiny simulation of the prompt wrapping to document the bug. Would have failed before the fix.

zoxide wraps prompt to run __zoxide_hook on every cd, but oh-my-posh
replaces prompt outright without chaining the old one. When zoxide was
initialized first its wrapper got overwritten — z still worked via
manual query but never learned new dirs.

Moved zoxide (and fnm, same hook) behind oh-my-posh so they wrap the
final prompt, and added a regression test that checks file ordering
and simulates the hook to keep this from regressing.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0fee1846-ea21-44d5-b865-81def1877ec5


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant