jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
2.99k stars 103 forks source link

Make implicitly global parameter declarations local #173

Open Saklad5 opened 2 years ago

Saklad5 commented 2 years ago

These parameters were not explictly marked as local, which causes zsh to make them global by default. This is presumably unintended, and pollutes the environment, so they have been explicitly made local in the manner already present in the file.

These parameters were found using the zsh option WARN_CREATE_GLOBAL. There may be other implicit global parameters present, as it only displays a warning when the relevant code is evaluated.

Saklad5 commented 2 years ago

I'm working on the assumption that all implicit global variables are unintentional, such that simply making them local fixes the issue. If any of them are meant to be global, they should be explicitly global: while I very much doubt any of these fall into that category, I recommend briefly skimming the changes before merging.

I will continue to force-push additional fixes along the same lines if I encounter any until it is merged.