jethrokuan / z

Pure-fish z directory jumping
MIT License
1.26k stars 44 forks source link

cached Z_DATA path not portable #104

Open ckoehler opened 2 years ago

ckoehler commented 2 years ago

Sorry if this is not a z issue, but a fish thing. I am new to both.

In z.fish, it sets Z_DATA and some other vars that include the $HOME directory. Unfortunately, $HOME is different for me on different machines, so I get errors when Z_DATA points to the data path of another machine.

Any way to fix that? Is it a fish thing? Thanks!

markstos commented 2 years ago

I think you are referring to setting some universal variables, which get written to ~/.config/fish_variables, like this:

SETUVAR Z_DATA:/home/mark/\x2elocal/share/z/data
SETUVAR Z_DATA_DIR:/home/mark/\x2elocal/share/z

The code says it only sets those universal variables of Z_DATA is not set. It uses if test -z "$Z_DATA". According to man test, this is checking if Z_DATA is zero-length or not.

https://github.com/jethrokuan/z/blob/master/conf.d/z.fish

So the solution is set Z_DATA on both of your machines with different values.

The document already recommends setting Z_DATA explicily: https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration)https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration

lorthirk commented 2 years ago

Uhm... this means we should set Z_DATA explicitly to the home path value in every machine... something that should be the default actually. Doesn't sound very clean.

Also, I can't see where the documentation "recommends" to set Z_DATA explicitly -- perhaps it has been edited in the meanwhile?

For reference, Fisher itself fixed this very issue here, so IMHO a similar approach could be considered.

itsfarseen commented 3 months ago

Here's my workaround for this: https://github.com/itsfarseen/dotfiles/blob/3df373b321e8f240eaba169611bfe9adab86c514/config/fish/conf.d/_z-make-portable.fish

More context: https://github.com/jorgebucaran/fisher/pull/746

markstos commented 3 months ago

I think this issue can be closed. Multiple comments have documented solutions that don't require modifying the code here.