zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.95k stars 126 forks source link

[bug]: zinit always generate zinit.1 to ~/.local/share/zinit/polaris/man/man1, even if $ZPFX is not ~/.local/share/zinit/polaris #413

Closed Freed-Wu closed 1 year ago

Freed-Wu commented 1 year ago

What happened?

ZPFX="$HOME/.local"
zinit id-as depth'1' null for zdharma-continuum/zinit

Expect ~/.local/man/man1/zinit.1, however ~/.local/share/zinit/polaris/man/man1/zinit.1

Steps to reproduce

As above

Relevant output

No response

Screenshots and recordings

No response

Operating System & Version

linux 6.02

Zsh version

5.9

Terminal emulator

wezterm

If using WSL on Windows, which version of WSL

No response

Additional context

No response

Code of Conduct

vladdoster commented 1 year ago

I think you should set "$ZINIT[MAN_DIR]" defined here.

Freed-Wu commented 1 year ago

Why not let $ZINIT[MAN_DIR] is $ZPFX/share/man by default?

Freed-Wu commented 1 year ago

I found I have two zinit.1, every time I delete them, next time they will be generated.

❯ ls ~/.local/man/man1 ~/.local/share/zinit/polaris/man/man1
/home/wzy/.local/man/man1:
 zinit.1

/home/wzy/.local/share/zinit/polaris/man/man1:
 zinit.1
Freed-Wu commented 1 year ago
ZPFX="$HOME/.local"
ZINIT[MAN_DIR]=$ZPFX/share/man
zinit id-as depth'1' null for zdharma-continuum/zinit

It still generate ~/.local/share/zinit/polaris/man

Freed-Wu commented 1 year ago

Oh, I must add $ZPFX before source zinit. Now it can work:

ZPFX="$HOME/.local"
typeset -A ZINIT
ZINIT[MAN_DIR]="$ZPFX/share/man"
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
if [[ -f $XDG_DATA_HOME/zinit/plugins/zinit/zinit.zsh ]]; then
  . $XDG_DATA_HOME/zinit/plugins/zinit/zinit.zsh
elif (($+commands[git])); then
  git clone --depth=1 https://github.com/zdharma-continuum/zinit \
    $XDG_DATA_HOME/zinit/plugins/zinit
  . $XDG_DATA_HOME/zinit/plugins/zinit/zinit.zsh
else
  return
fi