agkozak / agkozak-zsh-prompt

A fast, asynchronous Zsh prompt with color ASCII indicators of Git, exit, SSH, virtual environment, and vi mode status. Framework-agnostic and customizable.
MIT License
292 stars 26 forks source link

Removed explicit declaration for variable 'k' #20

Closed avalonwilliams closed 5 years ago

avalonwilliams commented 5 years ago

'k' was implicitly declared in the for loop, and isn't used outside of it. I noticed this while making some modifications to an offline copy of the theme, so I decided to open a PR.

agkozak commented 5 years ago

When I setopt WARN_CREATE_GLOBAL with your patch, zsh warns

_agkozak_branch_status:27: scalar parameter k created globally in function _agkozak_branch_status

Usually the warning flashes for a split second; it causes the left prompt to be displayed twice.

I think that means that zsh will perceive $k to be global unless we tell it otherwise; that's why I wrote the code the way I did.

avalonwilliams commented 5 years ago

I was not aware of this functionality of the shell, sorry.