Skip to content

Conversation

JeffMelton
Copy link

Murex is niche, but I use it, and I miss zoxide. 😄

@ajeetdsouza
Copy link
Owner

Hi, I've added some minor bugfixes and made it more consistent with the other shells. There's a few more things I'd like to fix before merging:

  • PWD hooks are possible to implement here. What you need to do is use a global variable called __zoxide_oldpwd, and set up a prompt hook that compares __zoxide_oldpwd with $PWD. If it has changed, set __zoxide_oldpwd=$PWD and call zoxide add $PWD (since the directory has changed).
  • z (with no arguments) does not work.
  • If you zoxide has no result for your query (e.g. z aoiejfaoiejf), you get a full error trace with a line number. Ideally, we should just return 1 in such a situation.

Do you think you could work on these?

@JeffMelton
Copy link
Author

JeffMelton commented Sep 7, 2025 via email

- PWD hook
- no-argument `z` goes HOME
- empty query results no longer throw a stack trace
@JeffMelton
Copy link
Author

All right, @ajeetdsouza, thanks for the feedback. I think I've covered your requests. Tests pass here, but I see the ubuntu CI test is still failing. I don't have nix-shell set up, but I'm trying to replicate as much as I can in a container environment. Do please let me know if you'd like to see anything else.

@JeffMelton
Copy link
Author

JeffMelton commented Sep 7, 2025

Ah, I've found a flaw in my implementation. I'll update again here once I think I've sorted it. Sorted (I think 😆 ). ✅

@ajeetdsouza
Copy link
Owner

Tried zoxide init murex -> source with murex v7.0.2107, but the hook does not seem to be working. A way to see if the hook is working is to do something like this:

zoxide query --score /tmp
z /tmp
# the score should have increased
zoxide query --score /tmp
# when in the same directory, the score should stay the same
zoxide query --score /tmp

Also, z with no arguments still doesn't seem to work for me:

Error in `__zoxide_z` (<stdin> 1,2637):
      Command: __zoxide_z  @PARAMS
      Error: array '@PARAMS' is empty

@JeffMelton
Copy link
Author

All right, thanks. I'll keep poking at it.

@JeffMelton
Copy link
Author

It was my understanding (perhaps incorrect) that I'd need to use the zoxide --prompt flag so that it would update the score if the hook picked up a directory change. That's working as expected here:

 🏡
μ →  murex --version
murex v7.0.2129 (website)
GPL v2
2018-2025 Laurence Morgan
μ →  /bin/tail -1 ~/.murex_profile
zoxide init murex --hook prompt -> source
μ →  zoxide query --score /tmp
zoxide: no match found
Error in `zoxide` (0,1): exit status 1
 🏡
μ →  z /tmp
/tmp
μ →  zoxide query --score /tmp
   4.0 /tmp
/tmp
μ →  z down
…/Downloads
μ →  zoxide query --score /tmp
   8.0 /tmp
…/Downloads
μ →  z tmp
/tmp
μ →  zoxide query --score /tmp
  12.0 /tmp

Have I misunderstood how that's supposed to work?

@ajeetdsouza
Copy link
Owner

The hook is basically designed to increment the score of a directory (using zoxide add), so that zoxide can keep track of how frequently that directory is being used.

  • --hook=prompt means that zoxide add $PWD is called every time the prompt is rendered (i.e. the user has run a command in their interactive shell).
  • --hook=pwd means that zoxide add $PWD is called every time the $PWD changes (i.e. the user has used cd or z to change their working directory). This is the default, because it:
    a. produces better results
    b. is more efficient, since it avoids running an external command (zoxide) on every shell prompt

Hope that clarifies things! Let me know if you have more questions, I'd be happy to help.

@JeffMelton
Copy link
Author

Okay, thanks, that does clarify. Mine is "working"/updating the score because it's overriding default, which means the PWD hook still isn't working right.

@JeffMelton
Copy link
Author

Okay, I think that's got it. Is that Ubuntu CI test significant? It reads like a linter issue, but I don't see anything I recognize as actionable. Let me know if you spot anything else in any case. Happy to keep iterating.

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.

2 participants