Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
felixgao opened this issue Feb 7, 2013 · 20 comments
Closed

Comments

@felixgao
Copy link

felixgao commented Feb 7, 2013

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.

@Lokaltog
Copy link
Member

Lokaltog commented Feb 7, 2013

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

@Lokaltog Lokaltog closed this as completed Feb 7, 2013
@danieltdt
Copy link

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?

@danieltdt
Copy link

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

@DanielGGordon
Copy link

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

@Ihsahn
Copy link

Ihsahn commented Oct 21, 2015

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

@DanielGGordon
Copy link

thanx!

@den-is
Copy link

den-is commented Jan 20, 2016

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.

@xenithorb
Copy link

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

@marcioAlmada
Copy link

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 ^^

@ghost
Copy link

ghost commented Mar 11, 2017

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

@ghost
Copy link

ghost commented Mar 11, 2017

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

@crewshin
Copy link

This was the command that I needed.

powerline-daemon --replace

Thanks @xenithorb

@briner
Copy link

briner commented Mar 26, 2018

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 ?

@ZyX-I
Copy link
Contributor

ZyX-I commented Mar 26, 2018

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

@aminnairi
Copy link

aminnairi commented May 27, 2018

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.

@Tset-Noitamotua
Copy link

Tset-Noitamotua commented Jan 13, 2019

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

CarbonChauvinist added a commit to CarbonChauvinist/dotfiles that referenced this issue Feb 10, 2019
Added .config/powerline/config.json copied from default
location of:
/usr/lib/python3.7/site-packages/powerline/config_files/

*This in prep to modify status line to show git branches
*powerline/powerline#186
@Yossarian0916
Copy link

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.

@gugol2
Copy link

gugol2 commented Mar 18, 2020

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.

@gugol2
Copy link

gugol2 commented Mar 18, 2020

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?

@digitalformula
Copy link

digitalformula commented Apr 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests