ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
https://crates.io/crates/zoxide
MIT License
23.13k stars 555 forks source link

[Enhancement] Work with environment variables #906

Closed WiIIiamWei closed 1 month ago

WiIIiamWei commented 1 month ago

I use Windows PowerShell and I tried this (I aliased zoxide to cd properly):

PS C:\Users\William> cd %temp%
zoxide: no match found

Which is expected to be:

C:\Users\William\AppData\Local\Temp

It would be nice if zoxide could work with these, I believe so called, "enviroment variables".

Could be the similar case of #855.

rajiknows commented 1 month ago

we can change the poershell.txt function for __zoxide_cd
we will check if the path is present in env , if it does than we will set the dir to that path .

ajeetdsouza commented 1 month ago

I'm not a Windows user, but isn't %temp% the syntax of CMD.EXE? I'm not sure I've followed the use case here.

WiIIiamWei commented 1 month ago

I'm not a Windows user, but isn't %temp% the syntax of CMD.EXE? I'm not sure I've followed the use case here.

Actually yes, blame me for not properly testing this. I only tried this on cmd because I don't want to touch my PowerShell profile to disable zoxide, and thought the same syntax would work for PowerShell. However I think it's still a small cool feature if it would work the same in PowerShell.

ajeetdsouza commented 1 month ago

I think that would be confusing for many users, I'd suggest wrapping the z command in your shell if you'd like this feature.