Closed PierreMarchand20 closed 4 years ago
Please post your zshrc.
You have the following line at the bottom of .zshrc:
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Please replace it with this:
print 'going to source ~/.p10k.zsh; press enter to continue'
read
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
print 'finished sourcing ~/.p10k.zsh; press enter to continue'
read
print 'going to dump POWERLEVEL9K parameters; press enter to continue'
read
typeset -pm 'POWERLEVEL9K_*'
print 'going to resume zsh initialization; press enter to continue'
read
Then restart zsh and let me know what happens.
root@85511bf76e58:~# zsh
going to source ~/.p10k.zsh; press enter to continue
finished sourcing ~/.p10k.zsh; press enter to continue
going to dump POWERLEVEL9K parameters; press enter to continue
typeset POWERLEVEL9K_CONFIG_FILE=/root/.p10k.zsh
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=5
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_CONTEXT_TEMPLATE='%F{242}%n@%m%f'
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
typeset POWERLEVEL9K_VCS_STAGED_ICON=''
typeset -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( dir vcs newline prompt_char )
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
typeset POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
typeset POWERLEVEL9K_VCS_DIRTY_ICON='*'
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
typeset POWERLEVEL9K_RIGHT_LEFT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=1
typeset POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
typeset POWERLEVEL9K_TIME_FOREGROUND=242
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3
typeset POWERLEVEL9K_VCS_BRANCH_ICON=''
typeset POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' '
typeset POWERLEVEL9K_VCS_COMMIT_ICON=@
typeset POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_VCS_UNTRACKED_ICON=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=5
typeset POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset POWERLEVEL9K_INSTANT_PROMPT=verbose
typeset POWERLEVEL9K_BACKGROUND=''
typeset POWERLEVEL9K_VCS_UNSTAGED_ICON=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset POWERLEVEL9K_DIR_FOREGROUND=4
typeset POWERLEVEL9K_TRANSIENT_PROMPT=off
typeset POWERLEVEL9K_VCS_OUTGOING_CHANGESFORMAT_FOREGROUND=6
typeset POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
typeset POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=' '
typeset POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=:⇣
typeset POWERLEVEL9K_LEFT_RIGHT_WHITESPACE=''
typeset POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=1
typeset POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
typeset POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset POWERLEVEL9K_LEFT_LEFT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=5
typeset POWERLEVEL9K_VCS_LOADING_TEXT=''
typeset POWERLEVEL9K_VIRTUALENV_FOREGROUND=242
typeset -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( command_execution_time virtualenv context newline )
typeset POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
typeset POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%F{7}%n%f%F{242}@%m%f'
typeset POWERLEVEL9K_RIGHT_RIGHT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=1
typeset POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=:⇡
typeset POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
typeset POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=1
typeset POWERLEVEL9K_VCS_FOREGROUND=242
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=1
typeset -a POWERLEVEL9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind )
typeset POWERLEVEL9K_VCS_INCOMING_CHANGESFORMAT_FOREGROUND=6
going to resume zsh initialization; press enter to continue
[powerlevel10k] fetching gitstatusd .. [ok]
and then my configuration is used.
and then my configuration is used.
Does it mean the configuration wizard didn't trigger? If yes, could you describe again what the issue is? I thought it was about configuration wizard triggering every time you start zsh but apparently I misunderstood.
Sorry, for being unclear.
.p10k
and the line for p10k in .zshrc
. (Here I just did q
to quit the configuration wizard)In both cases, I have the same .p10k
given earlier.
replacing the lines as you said, the configuration wizard is not triggered
So adding a bunch of print
and read
statements to .zshrc
suppresses the wizard? Could you figure out which line does that? Start with the code I posted and start removing extra debug lines one by one to see which one has this unexpected effect.
So just putting
print 'going to source ~/.p10k.zsh; press enter to continue'
read
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
seems to work, which is really weird. So I tried without using zim with the manual installation and it does work.
Do you have any idea how I could try to debug further ? Or do you want me to just raise an issue in the zimfw repo ?
Try this:
if [[ -f ~/.p10k.zsh ]]; then
print '~/.p10k.zsh exists'
source ~/.p10k.zsh
typeset -pm 'POWERLEVEL9K_*'
else
print '~/.p10k.zsh does not exists'
fi
print 'press enter to continue'
read
I got
root@838d0c02b9b9:~# zsh
~/.p10k.zsh exists
typeset POWERLEVEL9K_CONFIG_FILE=/root/.p10k.zsh
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=5
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_CONTEXT_TEMPLATE='%F{242}%n@%m%f'
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
typeset POWERLEVEL9K_VCS_STAGED_ICON=''
typeset -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( dir vcs newline prompt_char )
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
typeset POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
typeset POWERLEVEL9K_VCS_DIRTY_ICON='*'
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
typeset POWERLEVEL9K_RIGHT_LEFT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=1
typeset POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
typeset POWERLEVEL9K_TIME_FOREGROUND=242
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3
typeset POWERLEVEL9K_VCS_BRANCH_ICON=''
typeset POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' '
typeset POWERLEVEL9K_VCS_COMMIT_ICON=@
typeset POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_VCS_UNTRACKED_ICON=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=5
typeset POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset POWERLEVEL9K_INSTANT_PROMPT=verbose
typeset POWERLEVEL9K_BACKGROUND=''
typeset POWERLEVEL9K_VCS_UNSTAGED_ICON=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=''
typeset POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset POWERLEVEL9K_DIR_FOREGROUND=4
typeset POWERLEVEL9K_TRANSIENT_PROMPT=off
typeset POWERLEVEL9K_VCS_OUTGOING_CHANGESFORMAT_FOREGROUND=6
typeset POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
typeset POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=' '
typeset POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=:⇣
typeset POWERLEVEL9K_LEFT_RIGHT_WHITESPACE=''
typeset POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=1
typeset POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
typeset POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset POWERLEVEL9K_LEFT_LEFT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=5
typeset POWERLEVEL9K_VCS_LOADING_TEXT=''
typeset POWERLEVEL9K_VIRTUALENV_FOREGROUND=242
typeset -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( command_execution_time virtualenv context newline )
typeset POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
typeset POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%F{7}%n%f%F{242}@%m%f'
typeset POWERLEVEL9K_RIGHT_RIGHT_WHITESPACE=''
typeset POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
typeset POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=1
typeset POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=:⇡
typeset POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
typeset POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=1
typeset POWERLEVEL9K_VCS_FOREGROUND=242
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
typeset POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=1
typeset -a POWERLEVEL9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind )
typeset POWERLEVEL9K_VCS_INCOMING_CHANGESFORMAT_FOREGROUND=6
press enter to continue
[powerlevel10k] fetching gitstatusd .. [ok]
~ root@838d0c02b9b9
❯
So just putting
print 'going to source ~/.p10k.zsh; press enter to continue' read [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
seems to work
When I saw this comment I assumed that removing print
OR read
will cause configuration wizard to trigger. Maybe I should've asked you to confirm. Is this true? Do you need both of those lines to suppress configuration wizard?
I think this is caused by race conditions in .zlogin
that zimfw installs. Basically, the first time you start zsh, it's not loading your zshrc. It's loading the default shipped with zimfw.
Both
print 'going to source ~/.p10k.zsh; press enter to continue'
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
and
read
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
does not trigger the configuration wizard
Both [...] and [...] does not trigger the configuration wizard
I'm guessing any change will have this effect as long as you apply it the same way you've applied these two changes. E.g., you can add true
anywhere in the file.
It's just the way you make this change avoids triggering the race condition. See my comment above.
I'm closing this issue with the resolution that the configuration wizard is triggering because .zshrc
is not sourcing .p10k.zsh
.
Thank you for your answer, indeed just adding true also solves this issue. But could not we try to avoid this race condition ?
EDIT: I can raise the issue to zimfw if needed.
But could not we try to avoid this race condition ?
The race condition is not in powerlevel10k. If you use any other theme, you'll get the same problem. Namely, when you start zsh, it's not using .zshrc
you think it should be using.
I can raise the issue to zimfw if needed.
Do what you deem appropriate.
So first, I am aware of https://github.com/romkatv/powerlevel10k/blob/master/README.md#configuration-wizard-runs-automatically-every-time-zsh-is-started. What I do not understand is that I already have a
p10k.sh
file with my configuration, I have the lines for p10k in.zshrc
and I still have the configuration step the first time I use zsh.In the troubleshooting section, it is said it may be due to some error in
.zshrc
, but when I configure p10k, asking for override my configuration, it makes no modification to my.zshrc
and to works. So, am I missing something ? Do we still need to run the configuration step the first time we use p10k, even if we already have the.p10k
file ?I want to put my p10k configuration in a dotfile, and I would like to not have to configure p10k each time I pull my dotfiles (in a docker container for example).