zsh-z icon indicating copy to clipboard operation
zsh-z copied to clipboard

Make it XDG compliant

Open piegamesde opened this issue 5 years ago • 13 comments

Making the extension XDG compliant should be pretty straightforward: Simply replace local datafile=${ZSHZ_DATA:-${_Z_DATA:-${HOME}/.z}} with local datafile=${ZSHZ_DATA:-${_Z_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh/z}} (not tested).

Implementing it in a backwards-compatible way is a bit less straightforward though: The default file path case needs to check the legacy location in home first and then handle if it exists.

piegamesde avatar May 22 '20 22:05 piegamesde

Thanks for the good idea. I'm going to continue thinking about this one.

I see that there's a proposal to have rupa/z do something like what you suggest.

If rupa/z goes down that path, I will, of course, mimic it -- I like having ZSH-z continue to be a drop-in replacement for it. Let's keep this issue open.

agkozak avatar Jul 20 '20 20:07 agkozak

I wonder, does it make sense anymore to wait for rupa/z to make the first move? Clearly, that project isn't going anywhere at this rate, and even the project owner himself admitted he doesn't use zsh (anymore?)

ratijas avatar Dec 11 '20 09:12 ratijas

I think @rupa has always been solely a bash user; he was kind enough to rewrite his code so that it would work in zsh as well.

I'm sure I'm not the only person who uses both zsh with ZSH-z and bash with rupa/z, and it's nice to have rupa/z use the same database in bash without any extra configuration. I like the idea of having a tidier home directory (which is what I think XDG primarily aims for), but not at the expense of making the inter-operation of the two tools more complicated.

I'd like to leave this issue open and continue to cogitate about it.

In the meantime, remember that you can always set ZSHZ_DATA (or _Z_DATA, if you're using rupa/z as well) to any file you want.

agkozak avatar Dec 11 '20 18:12 agkozak

In the meantime, remember that you can always set ZSHZ_DATA

I did it and it doesn't work. I added in .zshrc string ZSHZ_DATA=$HOME/.config/zsh/.zhist and it continues to use the file .z in home

eugene-reim avatar Jan 02 '22 11:01 eugene-reim

@eugene-reim Strange -- it works for me. Would you mind posting your whole .zshrc so that I can try to pinpoint what's going wrong? Thanks!

agkozak avatar Jan 02 '22 14:01 agkozak

Yep, sure. zshrc.txt

eugene-reim avatar Jan 02 '22 14:01 eugene-reim

In line 93, you have

plugins=(z git sudo zsh-autosuggestions zsh-syntax-highlighting)

z is not my plugin -- that's rupa/z, as packaged by Oh-My-Zsh. If you want to use my plugin, you should follow the instructions here -- you'll want to make sure that you install Zsh-z and change that line to

plugins=(zsh-z git sudo zsh-autosuggestions zsh-syntax-highlighting)

Let me know if that works.

agkozak avatar Jan 02 '22 14:01 agkozak

Oh, sorry, I really didn't notice. I'll try it now, thanks.

eugene-reim avatar Jan 02 '22 14:01 eugene-reim

Yeah it works! Thank you so much and happy New Year btw!

eugene-reim avatar Jan 02 '22 14:01 eugene-reim

@eugene-reim Happy New Year!

agkozak avatar Jan 02 '22 14:01 agkozak