romkatv / zsh-defer

Deferred execution of Zsh commands
GNU General Public License v3.0
343 stars 11 forks source link

How to properly defer powerlevel10k? #5

Closed tmpm697 closed 4 years ago

tmpm697 commented 4 years ago

I want to gain a little speed when defer powerlevel10k plugin with zsh-defer but I got output as below when I defer ~/.cache/p10k-instant-prompt-${(%):-%n}.zsh and ~/.p10k.zsh

I have .zshrc:

source ~/zsh-defer.zsh
zsh-defer ~/.cache/p10k-instant-prompt-${(%):-%n}.zsh
zsh-defer ~/.p10k.zsh

zsh version: zsh 5.8 (x86_64-pc-linux-gnu) terminal: st tmux version: tmux next-3.2

When I start new z-shell in a tmux's pane, and then start another z-shell (prefix+), it old shell will echoes below output/mesg:

${$((_p9k_on_expand()))+}${(e)_p9k_t[7]}${_p9k__1-${_p9k__1l-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=}}+}${${:-"${${():-%}:#\#}"}:+${${:-${P9K_CONTENT::=user@localhost}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=28}}${_p9k__n:=${${(M)${:-x000}:#x($_p9k__bg|${_p9k__bg:-0})}:+30}}${_p9k__n:=31}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1lcontext+00}:-${${():-$_p9k__c1}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c} ${${:-${_p9k__s::=}${_p9k__ss::=}${_p9k__sss::=}${_p9k__i::=1}${_p9k__bg::=000}}+}}}${${:-"${${():-%}:#\"}:+${${:-${P9K_CONTENT::=user@localhost}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=32}}${_p9k__n:=${${(M)${:-x000}:#x($_p9k__bg|${_p9k__bg:-0})}:+34}}${_p9k__n:=35}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1lcontext+00}:-${${():-$_p9k__c1}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c} ${${:-${_p9k__s::=}${_p9k__ss::=}${_p9k__sss::=}${_p9k__i::=1}${_p9k__bg::=000}}+}}}${${:-${P9K_CONTENT::=${(Q)${:-"\\~/.config"}}}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=36}}${_p9k__n:=${${(M)${:-x004}:#x($_p9k__bg|${_p9k__bg:-0})}:+38}}${_p9k__n:=39}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1ldir+00}:-${${():-$_p9k__c1}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c} ${${:-${_p9k__s::=}${_p9k__ss::=}${_p9k__sss::=}${_p9k__i::=2}${_p9k__bg::=004}}+}}${(e)_p9k__vcs}$_p9k__sss${:-" "}}}${${COLUMNS::=$_p9k__clm}+}

This is output when I just create new shell but do not create another shell:

 user@localhost  ~/.config                                                                                                                                                                                                                                                                                                                                                                  ✔  2521  18:11:54

then if I press enter, it will bring back my custom shell prompt.

I expect there's no output/errors and the shell's prompt should appear as my customed shell's prompt.

I also can't properly defer zsh-syntax-highlighting.plugin.zsh but I'll ask it on reddit instead.

Thanks for creating another piece of art, I find it really helpful, even find it faster than zplugin when at least comes to cpu usage.

romkatv commented 4 years ago

Powerlevel10k has Instant Prompt, which is better than zsh-defer. So if you are using Powerlevel10k, enable instant prompt and don't use zsh-defer.

tmpm697 commented 4 years ago

I use instant prompt but we still have to source powerlevel10k.zsh-theme in powerlevel10k to make instance prompt work?

That is what I want to leverage it a bit by defer sourcing powerlevel10k.zsh-theme.

romkatv commented 4 years ago

I think you misunderstand what zsh-defer does. You should not use zsh-defer if you are using Powerlevel10k.

tmpm697 commented 4 years ago

In readme you said that it's compatible with powerlevel10k.

I understand that instant prompt will promise to give as its name but can you give reason why it echoes output when comes to defer it?

romkatv commented 4 years ago

In readme you said that it's compatible with powerlevel10k.

This says that you can use zsh-defer to to load plugins when you are using Powerlevel10k with Instant Prompt. It also says that you shouldn't.

can you give reason why it echoes output when comes to defer it?

No idea.