romkatv / powerlevel10k

A Zsh theme
MIT License
45.92k stars 2.17k forks source link

Prompt style doesn't show up in `p10k configure` wizard #642

Closed Shaunakde closed 4 years ago

Shaunakde commented 4 years ago

I am on a Ubuntu 14.04 machine and using the default terminal (Gnome terminal 3.6.2)

When I run p10k configure the first option I get is "Does this look like a diamond (rotated square)?" and I never see a screen to choose the prompt style. I installed the recommended font manually and have compiled from source the latest ncurses and zsh libraries.

This is the first screen I see: Selection_177

These are first screens I see (in order): Selection_178 Selection_179 Selection_180

I am able to apply themes by manually adding source ~/powerlevel10k/config/p10k-rainbow.zsh to the end of my config file, but I have no options to configure the angle/flat options, etc.

All this works flawlessly on my work MacBook, so I wonder if this is an OS-dependent thing.

romkatv commented 4 years ago

See https://github.com/romkatv/powerlevel10k/blob/master/README.md#icons-glyphs-or-powerline-symbols-dont-render

aral commented 4 years ago

@romkatv Experiencing the same thing on Pop!_OS 20.04 (~Ubuntu 20.04) with Kitty Terminal. Checked the link. Already had Powerline fonts installed and they were working perfectly with Agnoster but installed the ones from the link just to be sure and still the behaviour is the same.

romkatv commented 4 years ago

Already had Powerline fonts installed and they were working perfectly with Agnoster

If your terminal can display U+E0B0, then it can display it. If it cannot, then it cannot. It's impossible for your terminal to be able to display U+E0B0 when using Agnoster and being unable to display it when using Powerlevel10k.

You can check whether your terminal can display U+E0B0 with the following command:

zsh -fc "echo '\uE0B0'"

Or with plain printf (should work in any POSIX-based shell):

printf '\356\202\260\n'

The most common reason why your terminal may be unable to display U+E0B0 is that it's using a font that doesn't have this glyph. To fix this issue you need to install a font that has this glyph and then tell your terminal to use the font. See https://github.com/romkatv/powerlevel10k/blob/master/README.md#meslo-nerd-font-patched-for-powerlevel10k.

romkatv commented 4 years ago

See docs for how to change font in kitty: https://sw.kovidgoyal.net/kitty/conf.html.

aral commented 4 years ago

Hey @romkatv, thanks for your responses. I figured out what my problem was: it wasn’t the font.

For some reason, after I installed Kitty, using ssh started giving me a terminal error so, in my .zshrc, I’d set:

export TERM=xterm

So that was stopping powerlevel10k in the wizard.zsh ask_style function from displaying the prompt styles.

The fix was just to set TERM to xterm-256color instead in .zshrc:

export TERM=xterm-256color

Thanks again for your time.

Update: Just checked and I can’t reproduce the Kitty ssh error any longer so I’ve just removed my manual TERM override from my .zshrc and ssh is also working fine with the default value of xterm-kitty.

romkatv commented 4 years ago

Are you saying that export TERM=xterm made "the diamond" render incorrectly (see screenshot above)? This is very unlikely.

What export TERM=xterm does is disable colors above 16. If you attempt to print anything with color above 16, the output will be uncolored.

TERM=xterm zsh -fc 'print -P "%F{70}test%f"'
TERM=xterm-256color zsh -fc 'print -P "%F{70}test%f"'

The first line will be uncolored, while the second will be green.

If your terminal cannot display colors above 16, powerlevel10k wizard won't offer prompt styles that require colors above 16. It will have no effect on "the diamond".

aral commented 4 years ago

@romkatv No, the diamonds, etc., all rendered well. I just wasn’t getting the prompt styles screen shown because the wizard.zsh thought I couldn’t render 256 colors (as xterm can’t but xterm-256color and xterm-kitty can).

function ask_style() {
  if (( terminfo[colors] < 256 )); then
    # …
    return 0
  fi
  local extra
  add_widget 0 flowing -c "%BPrompt Style%b"
  # …

PS. Thank you so much for making powerlevel10k. I just found out about it today and love it already :)

romkatv commented 4 years ago

@romkatv No, the diamonds, etc., all rendered well.

Got it. I was confused by https://github.com/romkatv/powerlevel10k/issues/642#issuecomment-622954206, in which you said that you have the same problem as the OP of this issue.

I just wasn’t getting the prompt styles shown because of this:

Makes sense. As I mentioned above, you've made your terminal unable to display colors above 16, so powerlevel10k wasn't showing you prompt styles that require colors above 16. This is in the FAQ by the way: Some prompt styles are missing from the configuration wizard.

If the terminal can display fewer than 256 colors, configuration wizard preselects Lean style with 8 colors. All other styles require at least 256 colors. Fix: Use a terminal with 256 color support and make sure that TERM environment variable is set correctly. Verify with print $terminfo[colors].

aral commented 4 years ago

@romkatv Sorry for the confusion, the symptoms were identical :) And thanks again for your help and for this awesome theme – I love it and it has already improved my everyday experience immeasurably :)

Shaunakde commented 4 years ago

Update from me: I switched to Alacritty and the problem went away, so I did not re-open. I am certain the terminal was not actually choosing the font I set earlier. Thanks for all the detailed responses. Hopefully this thread can help others wondering why the install didn't work :)

romkatv commented 4 years ago

Update from me: I switched to Alacritty and the problem went away, so I did not re-open. I am certain the terminal was not actually choosing the font I set earlier.

Your terminal certainly wasn't using MesloLGS NF. This is clearly visible on the screenshots.

Thanks for all the detailed responses. Hopefully this thread can help others wondering why the install didn't work :)

FWIW, the configuration wizard worked as expected. The first few questions it asks you are meant to ascertain the capabilities of your font. After that the configuration wizard will offer you choices that are compatible with said capabilities.

So if you have to reply "no" to some questions (e.g., "does it look like a diamond?"), it's not an error. The wizard needs to know whether your terminal+font can display powerline glyphs. If it cannot, powerlevel10k will still work, but obviously you cannot use powerline glyphs.

aTGuz commented 4 years ago

Hello, thanks for this amazing work, my two cents to the issue, you must be sure that you set: set -g default-terminal "screen-256color" to your current terminal emulator config..., i'm using tmux and set this config to my .tmux.conf Be safe, cheers from Brazil!

justinfarrelldev commented 1 year ago
export TERM=xterm-256color

Just wanted to say that this was the fix for me on Git Bash (Windows). I simply went to Options -> Terminal by right-clicking the title bar and set "type" to xterm-256color instead of just xterm. Putting this here in the hopes it helps some other Git Bash user in the future!

romkatv commented 1 year ago

export TERM=xterm-256color

This is a terrible idea. Do this only if you are a hardcore expert and like shooting yourself in the foot for fun and no profit.

I simply went to Options -> Terminal by right-clicking the title bar and set "type" to xterm-256color instead of just xterm. Putting this here in the hopes it helps some other Git Bash user in the future!

This is the way 👍