zsh-z
zsh-z copied to clipboard
Make it XDG compliant
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.
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.
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?)
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.
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 Strange -- it works for me. Would you mind posting your whole .zshrc so that I can try to pinpoint what's going wrong? Thanks!
Yep, sure. zshrc.txt
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.
Oh, sorry, I really didn't notice. I'll try it now, thanks.
Yeah it works! Thank you so much and happy New Year btw!
@eugene-reim Happy New Year!