How to get the arrow style bash prompt after installing powerline?

8,452

Solution 1

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

Solution 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.

Share:
8,452

Related videos on Youtube

Community
Author by

Community

Updated on September 18, 2022

Comments

  • Community
    Community over 1 year

    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.

    • Michael D.
      Michael D. about 7 years
      Is your terminal using a powerline font?
    • Admin
      Admin about 7 years
      Yes I have installed powerline fonts. Specifically, I am using the source code pro for powerline.
    • JdeBP
      JdeBP about 7 years
      There was a more similar question on this stack exchange site at unix.stackexchange.com/questions/320735 .
    • Admin
      Admin about 7 years
      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
  • Admin
    Admin about 7 years
    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.
  • Anwar
    Anwar about 7 years
    @vikramreddym Make sure you're using the right profile. There can be multiple profiles for a given terminal. Which terminal are you using?
  • Admin
    Admin about 7 years
    It's a Gnome terminal I think. The default one on Ubuntu. I see that there is only one unamed profile in terminal preferences.
  • Anwar
    Anwar about 7 years
    Did you set the font in profile? Which version it is?
  • Admin
    Admin about 7 years
    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
  • Anwar
    Anwar about 7 years
    @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"
  • Admin
    Admin about 7 years
    Yes I have the custom font ticked. I get this output Sauce Code Powerline Regular.otf: "Source Code Pro for Powerline" "Regular"
  • Anwar
    Anwar about 7 years
  • AniketGM
    AniketGM over 4 years
    That's what I was looking for. Thanks a lot!
  • lyarwood
    lyarwood almost 4 years
    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
  • badola
    badola over 3 years
    This is what worked for me in Ubuntu 20.04 as well. By default, the locale was set to en_IN on my system.