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

Not displaying user #996

Open TheRandomTroll opened 5 years ago

TheRandomTroll commented 5 years ago

Whenever I run my ZSH, my username does not appear. And, if I enable the context, it doesn't show anything. The host name is displayed properly, but not the username.

Here is a photo of my terminal at the moment: screenshot from 2018-09-27 23-31-47

I haven't tweaked any of the code, neither in .zshrc, nor in the .zsh-theme file.

Here is my environment information:

onaforeignshore commented 5 years ago

Does the user segment work? POWERLEVEL9K_LEFT_PROMPT_SEGMENTS=( user ... )

TheRandomTroll commented 5 years ago

I tried adding both user and host to the segment. It only shows the host name.

onaforeignshore commented 5 years ago

What does echo $USER give you? What OS are you using?

TheRandomTroll commented 5 years ago
$ echo $USER
therandomtroll

I am using Ubuntu 18.04.1 LTS.

P.S. I also added a DEFAULT_USER to .zshrc and set it to therandomtroll. Still - no use.

onaforeignshore commented 5 years ago

Does print -P "%n" give you therandomtroll as well?

TheRandomTroll commented 5 years ago
$ print -P "%n"
therandomtroll

It does.

onaforeignshore commented 5 years ago

Can you check the content of $POWERLEVEL9K_CONTEXT_TEMPLATE and $POWERLEVEL9K_USER_TEMPLATE please?

TheRandomTroll commented 5 years ago

They echo %n@%m and %n respectively.

onaforeignshore commented 5 years ago

Then as far as I can tell the code is working correctly. Can you share your configuration file please?

TheRandomTroll commented 5 years ago

.zshrc powerlevel9k.zsh-theme

onaforeignshore commented 5 years ago

I see the issue: If you set DEFAULT_USER to your current username, the user isn't printed in the segment. This is so that the segment only prints when it is not you. If you want to see your user all the time, comment out or remove line 4 of your .zshrc file.

onaforeignshore commented 5 years ago

Line 629 for context and line 659 for user in the powerlevel9k.zsh-theme file

TheRandomTroll commented 5 years ago

I did it. The issue remains.

dritter commented 5 years ago

Just to be sure: after removing/uncommenting the DEFAULT_USER, you tested this in a new shell? To see this effect instantly (without removing that line / shell reloading), you need to unset DEFAULT_USER..

onaforeignshore commented 5 years ago

POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true always uses the POWERLEVEL9K_CONTEXT_TEMPLATE, while POWERLEVEL9K_ALWAYS_SHOW_USER=true always shows $(whoami) if the first one is false.