10

I have installed powerline. But my prompt looks like so instead of arrow shaped:

enter image description here

In vim, it looks ok:

enter image description here

I have seen the issue here: https://github.com/powerline/powerline/issues/1697. But the solution there doesn't work for me.

There is a similar question but his question was to achieve it without installing powerline here: https://stackoverflow.com/questions/32443522/triangular-background-for-bash-ps1-prompt

I am using Ubuntu 16.04. How do I get it right?

Edit: I have tried the following ways:

1) Used powerline fonts but made no difference.

2) Installation was done using pip3. It was installed under python3.5 directory. Since it is not giving the desired result, I have uninstalled and installed it using pip. But the installation directory remained same i.e. python3.5 and the result also remained the same. I then tried installing with python2.7 -m pip install powerline-status and it installed under python2.7 directory and it resulted in the same.

  • 1
    Is your terminal using a powerline font? – Michael D. Mar 19 '17 at 09:49
  • Yes I have installed powerline fonts. Specifically, I am using the source code pro for powerline. –  Mar 19 '17 at 10:02
  • There was a more similar question on this stack exchange site at http://unix.stackexchange.com/questions/320735/ . – JdeBP Mar 19 '17 at 16:04
  • If you are suggesting to use patched fonts for powerline, yes I have tried that and they seem to make no difference for me. Also it seems he did not install powerline in the first place –  Mar 19 '17 at 16:21

2 Answers2

7

I have fixed it by reconfiguring my locale.

I ran locale and it gave me this:

$ locale
LANG=en_IN.UTF-8
LANGUAGE=en_IN:en
LC_CTYPE="en_IN.UTF-8"
LC_NUMERIC="en_IN.UTF-8"
LC_TIME="en_IN.UTF-8"
LC_COLLATE="en_IN.UTF-8"
LC_MONETARY="en_IN.UTF-8"
LC_MESSAGES="en_IN.UTF-8"
LC_PAPER="en_IN.UTF-8"
LC_NAME="en_IN.UTF-8"
LC_ADDRESS="en_IN.UTF-8"
LC_TELEPHONE="en_IN.UTF-8"
LC_MEASUREMENT="en_IN.UTF-8"
LC_IDENTIFICATION="en_IN.UTF-8"
LC_ALL=

So I tried to set the following in .bashrc, but it didn't work:

export LANGUAGE=en_US.UTF-8   
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

So I ran the following and restarted the PC(Logging out wasn't enough):

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales

In the first configuration menu, I have deselected the en_IN... using spacebar and in next menu, I have selected en_US.UTF-8. After this locale showed all en_US.

Instead of all this, probably just setting LANUAGE and LANG to en_US in /etc/default/locale could have been enough? Idk

2

Install powerline fonts by cloning the repo (I'm cloning to a dir in home)

git clone https://github.com/powerline/fonts ~/powerline_fonts

Then link your desired font to your standard font directory. For example, if you've cloned the repo to a directory named powerline_fonts in your home, you'd use a command something like this.

ln -s ~/powerline_fonts/Anonymous\ Powerline.ttf ~/.local/share/fonts/

Set the preference of the terminal to use one of the powerline font such as "Anonymous for Powerline"

Now you should see the arrow shaped glyph.


Powerline uses special glyphs embedded in a font to render those nifty icons. So, you need a font that has those glyphs. Fortunately you can patch a font or use some already patched fonts like the ones from the repo I referenced earlier.

Anwar
  • 123
  • I have already installed powerline fonts and specifically using the source code pro for powerline in terminal. But I still don't get the arrow shape. –  Mar 19 '17 at 10:04
  • @vikramreddym Make sure you're using the right profile. There can be multiple profiles for a given terminal. Which terminal are you using? – Anwar Mar 19 '17 at 11:00
  • It's a Gnome terminal I think. The default one on Ubuntu. I see that there is only one unamed profile in terminal preferences. –  Mar 19 '17 at 11:05
  • Did you set the font in profile? Which version it is? – Anwar Mar 19 '17 at 11:07
  • Hello, yes I have set the font in the profile preferences. I have set it as "Source code pro for powerline regular" It's Gnome Terminal 3.18.3 –  Mar 19 '17 at 11:09
  • @vikramreddym I know this may seems weird, but did you check the "Custom Font" is enabled in Terminal Profile preference? Also give the output of fc-match "Source Code Pro for Powerline" – Anwar Mar 19 '17 at 11:16
  • 1
    Yes I have the custom font ticked. I get this output Sauce Code Powerline Regular.otf: "Source Code Pro for Powerline" "Regular" –  Mar 19 '17 at 11:19
  • FWIW you should just use the provided install.sh to install from the repo.git clone https://github.com/powerline/fonts ~/powerline_fonts && cd ~/powerline_fonts && ./install.sh – lyarwood Jun 27 '20 at 20:16