File tree 1 file changed +30
-0
lines changed 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -44,3 +44,33 @@ alias pnset='pnpm setup'
44
44
alias pnpub=' pnpm publish'
45
45
alias pnsv=' pnpm server'
46
46
alias pnx=' pn dlx'
47
+
48
+ # Standardized $0 handling
49
+ # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
50
+ 0=" ${${ZERO:- ${0:# $ZSH_ARGZERO } } :- ${(% ):-% N} } "
51
+ 0=" ${${(M)0:#/* } :- $PWD / $0 } "
52
+
53
+ # For zsh plugin managers that don't set $ZSH_CACHE_DIR for oh-my-zsh compatibility, like zi
54
+ # This is temporary, since I didn't see how it really works
55
+ if [[ -z " $ZSH_CACHE_DIR " ]]; then
56
+ mkdir -p " ${XDG_CACHE_HOME:- $HOME / .cache} /zsh/completions"
57
+ ZSH_CACHE_DIR=" ${XDG_CACHE_HOME:- $HOME / .cache} /zsh"
58
+ fi
59
+
60
+ # If the completion file doesn't exist yet, we need to autoload it and
61
+ # bind it to `pnpm`. Otherwise, compinit will have already done that.
62
+ if [[ ! -f " $ZSH_CACHE_DIR /completions/_pnpm" ]]; then
63
+ typeset -g -A _comps
64
+ autoload -Uz _pnpm
65
+ _comps[pnpm]=_pnpm
66
+ fi
67
+
68
+ {
69
+ # `pnpm completion` is only available from 9.0.0 onwards
70
+ if zstyle -t ' :completion:plugins:pnpm' legacy-completion || \
71
+ ! is-at-least 9.0.0 " $( command pnpm --version) " ; then
72
+ command cp " ${0: h} /completions/_pnpm" " $ZSH_CACHE_DIR /completions/_pnpm"
73
+ else
74
+ command pnpm completion zsh | tee " $ZSH_CACHE_DIR /completions/_pnpm" > /dev/null
75
+ fi
76
+ } & |
You can’t perform that action at this time.
0 commit comments