Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.47k stars 947 forks source link

zsh setopt posixargzero weird behaviour #1103

Open leodido99 opened 5 years ago

leodido99 commented 5 years ago

Hello,

I recently switched to zsh with powerlevel9k (thanks a lot for the work, awesome theme). Everything works fine but I work on embedded software and I use an OS in my applications, to be able to use this in my programs I have to source a script they provide to export properly env variables. I noticed that when I source this script, afterwards powerlevel9k outputs an error on prompt: setdefault:typeset:4: not valid in this context: POWERLEVEL9K/USR/BIN/ZSH_OK_VISUAL_IDENTIFIER_COLOR

I took a look at what the script does and at the start it does this:

if [ -n "$ZSH_VERSION" ]; then
        DIR="${(%):-%N}"
        if [ $options[posixargzero] != "on" ]; then
                setopt posixargzero
                NAME=$(basename -- "$0")
                setopt posixargzero
        else
                NAME=$(basename -- "$0")
        fi
else
        DIR="${BASH_SOURCE[0]}"
        NAME=$(basename -- "$0")
fi

So I spawned a shell and tried to enter setopt posixargzero and I got to reproduce the issue.

setopt posixargzero
set_default:typeset:4: not valid in this context: POWERLEVEL9K_/USR/BIN/ZSH_OK_VISUAL_IDENTIFIER_COLOR

This made me realise first that my OS script does setopt twice instead of unsetopt the second time. But I was wondering if this behaviour was as expected for powerlevel9k?

Thanks for your help

dritter commented 5 years ago

@leodido99 Sorry for the delay. What version of ZSH do you have on your embedded system?

leodido99 commented 5 years ago

No problem :)

zsh --version zsh 5.6.2 (x86_64-redhat-linux-gnu)

dritter commented 5 years ago

Crazy. If I set this option, I get no error message, but the prompt is pretty broken. Looks like we need to set noposixargzero. But to be honest that has no high prio in my list. I am sure there are some other options that would break the prompt as well..

romkatv commented 5 years ago

@leodido99 If you are still using Powerlevel9k, could you check if this issues can be reproduced with Powerlevel10k?

lbise commented 5 years ago

This doesn't seem to be reproductible with Powerlevel10k