agnoster / agnoster-zsh-theme

A ZSH theme designed to disclose information contextually, with a powerline aesthetic
3.94k stars 583 forks source link

Agnoster powerline icons are broken #103

Open KnownAsDon opened 5 years ago

KnownAsDon commented 5 years ago

After deciding to switch to agnoster theme after using robbyrussell for quite a while now I saw this bug with the powerline icons.

image

I installed manually the patched powerline fonts from the github repo. I am using vanilla arch linux with i3wm. Any help would be greatly appreciated.

jwir3 commented 5 years ago

I'm also having a similar issue. Note that I'm using Gnome Terminal 3.28.2 on Ubuntu 18.04 LTS. Screenshot from 2019-05-29 11-21-42

All of the icons appear to show up correctly, except that I get that circle/dot icon instead of the +- icon when a file is edited in my current git repo.

bellizio commented 4 years ago

I'm having the same issue as well after just switching to the agnoster theme.

apjanke commented 4 years ago

Where exactly did you download the patched Powerline fonts from? There are two versions of them, and you need to make sure you're using the new version of them. (At one point, they changed which private-use Unicode code points they use for the icons; all the current theme code should be using the new code points.)

I think that https://github.com/powerline/fonts/releases/tag/2015-12-04 will get you the right set.

bellizio commented 4 years ago

I have had the Fira Code fonts installed from here on my machine for a while, so I figured I wouldn't have any issues since FiraMono is in the Powerline fonts list.

I actually ran the check documented in the readme and got the expected result for all the characters (including +-). It's just that for whatever reason the +- icon results in a dot in my prompt.

apjanke commented 4 years ago

Hmmm. Okay, if you did the check in the README and it worked, then it seems to me like it ought to be working, and I don't know what's going on. Sorry.

apjanke commented 4 years ago

I'm afraid I cannot reproduce. I'm running an Ubuntu 18.04 VM (under VMware on macOS 10.14) with a pretty fresh Ubuntu install. I did a fresh install of agnoster (by just cloning the repo) and a fresh install of the Powerline-patched fonts by downloading them from https://github.com/powerline/fonts/releases/tag/2015-12-04 and running the install.sh script inside them. Switched to Meslo LG M for Powerline in Gnome Terminal, loaded Agnoster, and it worked fine; I see the +- in my prompt.

apjanke commented 4 years ago

@bellizio and @jwir3: Here's an idea. The Agnoster theme code gets that +- symbol from the (global) shell variable $PLUSMINUS, which is initialized upon loading agnoster.zsh-theme here, but is re-evaluated each time the prompt is displayed. (I think that's intentional, to allow users to customize their symbols.) Is it possible that something else in your zsh environment/code is setting and clobbering $PLUSMINUS?

What happens if you do this?

echo "char: \u00b1 PLUSMINUS: $PLUSMINUS"

It should look like this:

Screen Shot 2020-01-02 at 5 07 38 PM

If you get two different symbols, then you've probably got a variable-clobbering problem going on.

apjanke commented 4 years ago

@KnownAsDon: What terminal emulator (and version) are you running, and what are your locale settings? Is your terminal set to display Unicode? That screenshot looks like the multibyte Unicode characters used for the Powerline symbols are getting misinterpreted as multiple, fewer-bytes characters.

bellizio commented 4 years ago

@apjanke thanks for digging in further and the info about the shell variable.

So I ran echo "char: \u00b1 PLUSMINUS: $PLUSMINUS" and here's what I got:

Screen Shot 2020-01-02 at 8 08 15 PM

Notice there's no value for $PLUSMINUS. To troubleshoot more, I even tried other powerline fonts like Meslo LG M for Powerline and still got the same result. I'm not sure what's causing it at this point.

apjanke commented 4 years ago

Bazinga! You've got something in your other zsh configuration code (maybe prompt setup) that is stomping on the $PLUSMINUS variable and breaking Agnoster. (This could partly be considered Agnoster's fault for not prefixing all its variables with $AGN_ or something. They're globals!) This is not an Agnoster problem, but I'll try to help you figure it out anyway.

This is totally not a font or terminal configuration problem; don't bother messing with them any more.

What other zsh stuff are you running? Oh My Zsh? Prezto? Any other themes?

What's in your ~/.zshrc? Can you share your dotfiles with us? (E.g. I've got all mine up at https://github.com/apjanke/dotfiles.)

bellizio commented 4 years ago

@apjanke that's what I was thinking after you pointed it out.

I am running Oh My Zsh. Here's my .zshrc file.

apjanke commented 4 years ago

Welp. Nothing suspicious in your .zshrc. And I don't see anything in Oh My Zsh that affects $PLUSMINUS.

But here's the thing: since you're loading Oh My Zsh, and setting ZSH_THEME="agnoster" there, I think you're actually pulling in Oh My Zsh's fork of the Agnoster theme, which has diverged significantly, and not the code in this repo. Maybe head over there and ask the same question?

bellizio commented 4 years ago

@apjanke bingo, that's it. Looked at the ohmyzsh version of the theme and noticed there is no PLUSMINUS variable set.

So I took the agnoster theme straight from this repo, added it to the /.oh-my-zsh/custom/themes folder, and voila! I now have the +- showing up.

apjanke commented 4 years ago

Great!

jwir3 commented 4 years ago

@bellizio Did you report this as an issue with Oh My Zsh? Your solution fixed my issue, so I thought it might be worth reporting it to them so they can fix it/back merge from their end.

bellizio commented 4 years ago

@apjanke @jwir3 @KnownAsDon I have opened an issue in the ohmysh repo here.

marviniciuz commented 11 months ago

I have this problem in agnoster theme, I'm using windows wsl with ubuntu 20.04.6. problemterminal

It is not working as it should in native linux

vnpnlz commented 9 months ago

@marviniciuz I got mine working by using Fira Code. When you get the font installed, open Ubuntu, then right-click on WSL top panel > Properties > Font tab > under Font, select Fira Code.