style: declare globals properly

By default, `typeset` defines variables locally unless in the main scope.
This is specially bad when using `omz plugin load`, which happens inside
a function, so the declared variables don't continue being defined when
the function finishes and the main scope reappears.
This commit is contained in:
Marc Cornellà
2022-01-05 09:10:32 +01:00
parent 31d63ea884
commit d3bb52d7d8
11 changed files with 12 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ command mkdir -p "$ZSH_CACHE_DIR/completions"
# bind it to `cargo`. Otherwise, compinit will have already done that
if [[ ! -f "$ZSH_CACHE_DIR/completions/_cargo" ]]; then
autoload -Uz _cargo
declare -A _comps
typeset -g -A _comps
_comps[cargo]=_cargo
fi
@@ -19,7 +19,7 @@ fi
# bind it to `rustup`. Otherwise, compinit will have already done that
if [[ ! -f "$ZSH_CACHE_DIR/completions/_rustup" ]]; then
autoload -Uz _rustup
declare -A _comps
typeset -g -A _comps
_comps[rustup]=_rustup
fi