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.46k stars 949 forks source link

Custom functions not working in ubuntu prompt #1321

Closed sid374 closed 5 years ago

sid374 commented 5 years ago

Describe Your Issue

Custom functions in Ubuntu are not working

Here is my zshrc:

POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
POWERLEVEL9K_CUSTOM_HOST_NAME="echo Docker-MASTER"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_host_name dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator time history battery)

I can't get "Docker-MASTER" to appear on my prompt.

A little bit about my environment: I have a mac and am running a docker container running ubuntu inside it. I have the same powerlevel9k configs in both my local mac and docker. Everything works as expected on the mac, but the ubuntu docker prompt does not show my custom command.

Also, I am running powerlevel10k. Not sure if this is something specific to that.

Screenshots: https://prnt.sc/o88azs https://prnt.sc/o88b4u

Have you tried to debug or fix it?

I think I've narrowed down the problem to the function prompt_custom in p10k.sh.

The line local -a cmd=("${(@Q)${(z)${(P):-POWERLEVEL9K_CUSTOM_${segment_name}}}}") returns POWERLEVEL9K_CUSTOM_HOST_NAME on my ubuntu where as it returns echo LOCAL on my mac.

Please let me know if there's any other information I can include. Thanks for the help!

Syphdias commented 5 years ago

As far as I can tell, this was exclusive to p10k and was taken care of in https://github.com/romkatv/powerlevel10k/issues/96