Powerline: Bash Powerline not showing git branch info, but vi is working correctly.

Created on 7 Feb 2013  ·  20Comments  ·  Source: powerline/powerline

Screen Shot 2013-02-06 at 5 35 17 PM
but if I do vi set.py I do see git branch info
Screen Shot 2013-02-06 at 5 36 12 PM

in my vimrc i have the following
. /Users/felix/Personalization/powerline/powerline/bindings/bash/powerline.sh

running iterm2 1.0.0.20130204-nightly on OSX 10.8.2

also if someone can tell me how to add server info to my prompt that would be great.

cshell sconfiguration error bug

Most helpful comment

For the people from google:

mkdir -p ~/.config/powerline
cat <<-'EOF' > ~/.config/powerline/config.json
{
    "ext": {
        "shell": {
            "theme": "default_leftonly"
        }
    }
}
EOF
powerline-daemon --replace 

This works because configs are merged

All 20 comments

You have to enable the default_leftonly theme in your user configuration.

I tried to do that but I have no idea how to "change my user configuration" :(
I'm using powerline from source (doing "pip install --user -e /home/daniel/workspace/powerline" and adding ". /home/daniel/workspace/powerline/powerline/bindings/bash/powerline.sh").

What should I change to get git branch on my prompt?

WOW I have just read the docs (https://powerline.readthedocs.org/en/latest/configuration.html) and understood! ( sorry about the comment above :S )

@danieltdt that documentation is confusing. I can't figure out which file to change (and what to change)

@DanielGGordon Either modify main config.json or make a local copy (into ~/.config/powerline) and change shell->theme from "_default_" to "_default_leftonly_"

thanx!

I have followed all the steps but still have this problem on Fedora 23:
powerline-status (2.3) installed with pip2 (python 2.7.10)
have both pygit2 (0.22.1) for python2 and python3
created user config in ~/.config/powerline/config.json which works coz i can see that it applies colorscheme. but git still doesn't work

{
  "common": {
    "term_truecolor": false
  },
  "ext": {
    "ipython": {
      "colorscheme": "default",
      "theme": "in",
      "local_themes": {
        "rewrite": "rewrite",
        "out": "out",
        "in2": "in2"
      }
    },
    "shell": {
      "colorscheme": "solarized",
      "theme": "default_leftonly",
      "local_themes": {
        "continuation": "continuation",
        "select": "select"
      }
    },
    "tmux": {
      "colorscheme": "default",
      "theme": "default"
    }
  }
}

Edited main config .json in powerline install root/config_files - still nothing.

For the people from google:

mkdir -p ~/.config/powerline
cat <<-'EOF' > ~/.config/powerline/config.json
{
    "ext": {
        "shell": {
            "theme": "default_leftonly"
        }
    }
}
EOF
powerline-daemon --replace 

This works because configs are merged

I agree that the documentation for customization managed to be verbose and confusing at the same time. I still have no idea where is powerline_root on my setup.

@xenithorb worked for me btw ^^

Are you saying there a master config.json of sorts? And ~/.config/powerline/config.json overrides matching keys?

The docs I was reading dont seem to efficaciously educate the json schema

I found some language on a website after googling for more info. I think this is how it's supposed to be done to get the user started with the base/defaults. Then can edit as needed

I happen to install with pip --user , so my bits are in ~/.local/ ,

note: ~/.local/lib/python3.5/site-packages/... in path is variable depending on your system configuration

mkdir -p ~/.config/powerline && cp -R ~/.local/lib/python3.5/site-packages/powerline/config_files/* ~/.config/powerline/ && cd ~/.config/powerline && ls -alF --color=auto
Then as @xenithorb mentioned, edit `~/.config/powerline/config.json` `ext` => `shell` => `theme` value from `default` to `default_leftonly` ex:
{
        "common": {
                "term_truecolor": false
        },
        "ext": {
                "ipython": {
                        "colorscheme": "default",
                        "theme": "in",
                        "local_themes": {
                                "rewrite": "rewrite",
                                "out": "out",
                                "in2": "in2"
                        }
                },
                "pdb": {
                        "colorscheme": "default",
                        "theme": "default"
                },
                "shell": {
                        "colorscheme": "default",
                        "theme": "default_leftonly",
                        "local_themes": {
                                "continuation": "continuation",
                                "select": "select"
                        }
                },
                "tmux": {
                        "colorscheme": "default",
                        "theme": "default"
                },
                "vim": {
                        "colorscheme": "default",
                        "theme": "default",
                        "local_themes": {
                                "__tabline__": "tabline",

                                "cmdwin": "cmdwin",
                                "help": "help",
                                "quickfix": "quickfix",

                                "powerline.matchers.vim.plugin.nerdtree.nerdtree": "plugin_nerdtree",
                                "powerline.matchers.vim.plugin.commandt.commandt": "plugin_commandt",
                                "powerline.matchers.vim.plugin.gundo.gundo": "plugin_gundo",
                                "powerline.matchers.vim.plugin.gundo.gundo_preview": "plugin_gundo-preview"
                        }
                },
                "wm": {
                        "colorscheme": "default",
                        "theme": "default"
                }
        }
}

Also Note: If the daemon is running, the changes made to ~/.config/powerline/* files will be prevented from taking effect until you stop or restart the daemon. Check to see if the daemon is running with ps aux | grep powerline , Either way, the daemon can be started/restarted with powerline-daemon --replace

This was the command that I needed.

powerline-daemon --replace

Thanks @xenithorb

Hi,

Is there a way to get extra information on git. I'd love to know if:

  • my repo needs some commit.
  • my git needs to be pushed on the origin.

I've seen this https://github.com/jaspernbrouwer/powerline-gitstatus#installation and I was wondering if such things already exist or not in powerline ?

No, you would need to use third-party modules like the one you mentioned.

Archlinux Bash Powerline

Everything is detailed in the official documentation. This comment is just a quick TL;DR for those who doesn't have time to read and/or are lucky to succeed with those steps.

Installation's commands

$ pacman -S powerline powerline-fonts

Create a per-user configuration folder

$ mkdir -p ~/.config/powerline/

Copy the configuration file

$ cp /usr/lib/python3.6/site-packages/powerline/config_files/config.json ~/.config/powerline

The python version is likely to change. Check your local path to see if it does match with mine.
N.B.: for us, Arch users, the powerline_root segment from the powerline's documentation correspond to that path. Worth mentioning.

Change the theme

You have to change the ext.shell.theme property from default to default_left_only.

{
  ...
    "ext": {
    ...
        "shell": {
            "colorscheme": "default",
            "theme": "default_leftonly",
            "local_themes": {
                "continuation": "continuation",
                "select": "select"
            }
        },
    ...
    }
}

Appy changes

powerline-daemon --replace

Or simply close and open a new shell.

Bash Powerline with Git status - Deepin Linux 15

(Debian and Ubuntu should work the same way)

image - Deepin Linux Bash Powerline Git Status

TL;DR

pip install powerline-status

wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf

# NOTE: adjust fonts paths properly!
mv PowerlineSymbols.otf /usr/share/fonts/

fc-cache -vf /usr/share/fonts/

mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/

# add this to your .bashrc
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. {powerline-installation-dir}/bindings/bash/powerline.sh

mkdir -p ~/.config/powerline
# NOTE: adjust your {powerline-installation-dir} properly!
cp /{powerline-installation-dir}/config_files/config.json ~/.config/powerline

# edit ~/.config/powerline/config.json to see git status and branch name in prompt
    { ...
         "theme": "default_leftonly",
      ... 
    }

# edit "def __call_()" function in vcs.py (may require sudo)
# vcs.py location --> /{powerline-installation-dir}/segments/common/vcs.py
# change "status_colors=False" --> status_colors=True
# change "ignore_statuses=()" --> ignore_statuses=(["U"]) to ignore untracked files
def __call__(self, pl, segment_info, create_watcher, status_colors=True, ignore_statuses=()):

# FINISH! APPLY CHANGES!
powerline-daemon --replace

Need a bit more details? --> Gist - 10 Steps to Bash Powerline for Deepin Linux (Debian / Ubuntu)

Need even more details? --> Official Documentation

Besides powerline, you should alsopip install powerline-gitstatus , if you'd like to show git prompt in terminal. I also found a useful post on Medium for your problem. Although this tutorial is based on macOS, but I've tested his method on my Ubuntu18.04 and it worked! Hope this will help you.

I had trouble installing powerline-gitstatus with apt install in Ubuntu 18.04, maybe the repo is not maintained anymore. I didn't try to install it with pip though.

Another thing... in my .bashrc file I only added:

if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi

Nothing about the daemon and this stuff:

powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1

My questions are:
-Do I have to add those lines to my .bashrc file as well?
-Should I apt remove powerline and install it with pip?

Another thing... in my .bashrc file I only added:

if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi

Nothing about the daemon and this stuff:

powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1

My questions are:
-Do I have to add those lines to my .bashrc file as well?
-Should I apt remove powerline and install it with pip?

I installed Powerline-status using pip3:

pip3 install powerline-status
pip3 install powerline-gitstatus

Created these directories:

~/.config/powerline
~/.config/powerline/themes/shell
~/.config/powerline/colorschemes

And created these files based on various comments above:

~/.config/powerline/colorschemes/default.json
~/.config/powerline/themes/shell/default.json
~/.config/powerline/config.json

Added these lines to ~/.bashrc as queried above:

# Powerline startup
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source {{ powerline_location.stdout }}/powerline/bindings/bash/powerline.sh

Note the last line contains a variable because I'm doing all this through Ansible.

Now my Konsole looks like this:

powerline

I'm also using Ansible to install the Powerline patched fonts, but that's outside the scope of this issue & question.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

s-ol picture s-ol  ·  5Comments

Chris-Bee picture Chris-Bee  ·  3Comments

adamk33n3r picture adamk33n3r  ·  4Comments

pklebba picture pklebba  ·  5Comments

ghost picture ghost  ·  7Comments