Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatability with WARN_CREATE_GLOBAL zsh option #101

Open
ratijas opened this issue Nov 24, 2020 · 4 comments · May be fixed by #102
Open

Compatability with WARN_CREATE_GLOBAL zsh option #101

ratijas opened this issue Nov 24, 2020 · 4 comments · May be fixed by #102

Comments

@ratijas
Copy link

ratijas commented Nov 24, 2020

Summary

Global variables should be declared with typeset -g option. Partially for documentation purposes, but also because WARN_CREATE_GLOBAL zsh option doesn't like it any other way:

k:138: scalar parameter K_COLOR_DI created globally in function k
k:139: scalar parameter K_COLOR_LN created globally in function k
k:140: scalar parameter K_COLOR_SO created globally in function k
k:141: scalar parameter K_COLOR_PI created globally in function k
k:142: scalar parameter K_COLOR_EX created globally in function k
k:143: scalar parameter K_COLOR_BD created globally in function k
k:144: scalar parameter K_COLOR_CD created globally in function k
k:145: scalar parameter K_COLOR_SU created globally in function k
k:146: scalar parameter K_COLOR_SG created globally in function k
k:147: scalar parameter K_COLOR_TW created globally in function k
k:148: scalar parameter K_COLOR_OW created globally in function k
k:149: scalar parameter K_COLOR_BR created globally in function k

Alternatives

How about switching to an associative array (a.k.a. dictionary/hash-table) instead of a bunch of independent variables? I have successfully done this in oh-my-zsh plugin once: ohmyzsh/ohmyzsh#9437

@ratijas ratijas changed the title compatability with WARN_CREATE_GLOBAL zsh option Compatability with WARN_CREATE_GLOBAL zsh option Nov 24, 2020
ratijas added a commit to ratijas/k that referenced this issue Nov 24, 2020
WARN_CREATE_GLOBAL zsh option didn't like it:

k:138: scalar parameter K_COLOR_DI created globally in function k
k:139: scalar parameter K_COLOR_LN created globally in function k
...

Closes supercrabtree#101
@ratijas ratijas linked a pull request Nov 24, 2020 that will close this issue
ratijas added a commit to ratijas/dotfiles that referenced this issue Nov 24, 2020
WARN_CREATE_GLOBAL zsh option didn't like it:

k:138: scalar parameter K_COLOR_DI created globally in function k
k:139: scalar parameter K_COLOR_LN created globally in function k
...

Related issue: supercrabtree/k#101
@ratijas
Copy link
Author

ratijas commented Dec 3, 2020

Hi @supercrabtree

Could you take a look, please?

@ratijas
Copy link
Author

ratijas commented Mar 4, 2021

ping @supercrabtree

@ratijas
Copy link
Author

ratijas commented Mar 18, 2021

@supercrabtree are you alive?

@ratijas
Copy link
Author

ratijas commented Mar 30, 2021

henlo darkness my old friend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant