Closed psprint closed 4 years ago
I removed the local
from that function, and quotes some things. Care to test again? Also I'm going to have to figure out how to test on different zsh versions.
I added a Dockerfile to test zsh-5.0.0
are you still getting this issue?
Yes :)
I made a Dockerfile using zsh-users-5.0.0 but I get a different error
So I'm having trouble reproducing this issue on the latest mnml branch. I made a Dockerfile that should provide a common environment to test for the issue, but I'm at a loss of how to debug.
There was a bugfix branch from a few years ago, that changed instances of local _ctx_plugins=()
to twoliners, local _ctx_plugins; _ctx_plugins=()
. Should investigate those fixes as well.
Is this still a problem?
Running in the dockerfile, this seems to be fixed.
I've just checked, both geometry and mnml doesn't yield this error
Too early a success call – I've just got:
mnml::wrap:local:7: not valid in this context: %F{red}3%f$MNML_GIT_SEPARATOR%F{red}\u2b21%f
mnml::wrap:local:7: not valid in this context: %F{red}3%f$MNML_GIT_SEPARATOR%F{red}\u2b21%f
mnml::wrap:local:7: not valid in this context: %F{red}3%f$MNML_GIT_SEPARATOR%F{red}\u2b21%f
and it seems to come from zsh-5.7.1:
Can you get that error using the dockerfile? Because I tried 5.7.1 and it seems to be working...
Also might have to do with some quoting https://github.com/zsh-users/zsh-autosuggestions/issues/127
So the local var=$( ... )
should be changed to a quoted version local var="$( ... )"
. I did a quick search and found a few of such cases:
▲ .zplugin/plugins/geometry-zsh---geometry ack local.\*'[^"]\$\(' mnml 9d :: ⬡
functions/geometry_hg.zsh
7: local branch="$(ansi ${GEOMETRY_HG_COLOR_BRANCH:=242} $(hg branch 2> /dev/null))"
10: && local symbol=$(ansi ${GEOMETRY_HG_COLOR_DIRTY:=red} ${GEOMETRY_HG_SYMBOL_DIRTY:="⬡"}) \
11: || local symbol=$(ansi ${GEOMETRY_HG_COLOR_CLEAN:=green} ${GEOMETRY_HG_SYMBOL_CLEAN:="⬢"})
functions/geometry_rust_version.zsh
6: local rust_version=$(rustc --version | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')
functions/geometry_git.zsh
55: local_commit=$(git rev-parse "@" 2>/dev/null)
functions/geometry_status.zsh
20: local sum=0; for c in ${(s::)^HOST}; do ((sum += $(print -f '%d' "'$c"))); done
22: local index=$(($sum % ${#colors}))
functions/geometry_npm_package_version.zsh
10: local npm_package_version=$(\grep version package.json | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')
12: local symbol=$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR $GEOMETRY_NPM_PACKAGE_SYMBOL)
13: local version=$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_COLOR v$npm_package_version)
Zsh 5.0 is now 7 years old, but maybe it's worth to fix this.
I'm not sure I can fix line 20 of geometry_status, because of the quotes in quotes. Will zsh understand
sum += "$(print -f '%d' "'$c")"
?
Yes I think that Zsh properly understands such embedded quoting.
The error message appearing when running under zsh-5.0.0: