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

lazy-loading creates "attempt to assign private in nested scope" error

Open andronocean opened this issue 3 years ago • 0 comments

Hi, and thanks for this great project. I'm having an issue when loading zsh-nvm using zsh-snap ("znap") plugin manager with the setup shown at marlonrichert/zsh-launchpad.

I get this error: cmd: attempt to assign private in nested scope, related to this line in the _zsh_nvm_lazy_load function:

https://github.com/lukechilds/zsh-nvm/blob/23067bd9bb6eb6f4737a3ea90cb0cb5e85f61ba2/zsh-nvm.plugin.zsh#L106

I think this is happening since my .zshrc is configured to znap source plugins inside an anonymous function.

I was able to fix it by explicitly marking cmd as local:

# Create function for each command
  local cmd
  for cmd in $cmds; do

andronocean avatar Feb 18 '22 18:02 andronocean