Powerline: Powerline default shell theme no longer shows git branch on the right

Created on 13 Oct 2016  ·  15Comments  ·  Source: powerline/powerline

Hello,

I recently installed powerline in a new laptop ArchLinux installation and using the default shell theme for some reason the git branches no longer appear on the right of the terminal. There is quite a lot of space on my screen for it to appear but it does not appear. I even tried with "priority": None which should always make it show but that also did not work.

Powerline Version: 2.5.1
OS: Archlinux
Installed By: Pacman, the package manager of the distro

I renamed default shell theme to lef.json and made some changes to assure that it's getting picked up and the changes were getting picked up so we can be sure that powerline recognizes, parses and uses those files.

config.json

{
    "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": "lef",
            "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"
        }
    }
}

lef.json theme (basically copy paste of default.json for shell)

{
    "segments": {
        "left": [
            {
                "function": "powerline.segments.shell.mode"
            },
            {
                "function": "powerline.segments.common.net.hostname",
                "priority": 10
            },
            {
                "function": "powerline.segments.common.env.user",
                "priority": 30
            },
            {
                "function": "powerline.segments.common.env.virtualenv",
                "priority": 50
            },
            {
                "function": "powerline.segments.shell.cwd",
                "priority": 10
            },
            {
                "function": "powerline.segments.shell.jobnum",
                "priority": 20
            }
        ],
        "right": [
            {
                "function": "powerline.segments.shell.last_pipe_status",
                "priority": 10
            },
            {
                "function": "powerline.segments.common.vcs.stash",
                "priority": 50
            },
            {
                "function": "powerline.segments.common.vcs.branch",
                "priority": 40
            }
        ]
    }
}

Any idea on how to address this issue would be greatly appreciated.

VCS support cshell bug

Most helpful comment

@LefterisJP ahhh... just found some other docs which says that bash doesn't support the right side prompts. So that explains why the default shell theme didn't work. I'm gonna go ahead and use the default_leftonly theme.

Are you using bash or another shell. If the former then probably that is the reason why it is not working for you as well.

All 15 comments

What does git status output? Can you try to run powerline.lib.vcs.guess manually in an interactive python session?

@s-ol git status and git branch work as expected. I am in a git repository.

But powerline.lib.vcs.guess does not work from an interactive python session. Or at least I assume it does not work because it returns an empty object. I don't know much about powerline internals so let me just paste it here for you:

Python2:

Python 2.7.12 (default, Jun 28 2016, 08:31:05)
[GCC 6.1.1 20160602] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import powerline.lib.vcs as vcs
>>> vcs.guess(".", False)
<powerline.lib.vcs.git.Repository object at 0x7f495258aeb0>
>>> a = vcs.guess(".", False)
>>> a.__dict__
{}

Python3:

Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import powerline.lib.vcs as vcs
>>> vcs.guess(".", False)
<powerline.lib.vcs.git.Repository object at 0x7f93f665ce58>
>>> a = vcs.guess(".", False)
>>> a.__dict__
{}

@LefterisJP Why you think it is empty? __dict__ is not the only place where object attributes may be contained. In fact, there _must be_ no attributes there, class in question is using __slots__.

This function could not return an “empty” object, it returns either usable Repository or None.

Wondering whether you have reloaded the daemon after making changes to configuration (if using zsh+zpython, restart zsh or use powerline-reload-config).

@ZyX-I Oh I see. Did not know about python's __slots__. Thanks for that!

So:

>>> a.__slots__
('directory', 'create_watcher')

I don't have a daemon running. I just have:

source /usr/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh

in my .zshrc.

This way it was working fine for a long time in my other computer. I don't thnink I have ever used a daemon.

@LefterisJP Have you got this resolved yet? Interestingly if you choose the theme default_leftonly.json for the shell config, then the git branches appears on the prompt to the left. Looks like there is something that is preventing the right segment from showing up on the shell.

@LefterisJP ahhh... just found some other docs which says that bash doesn't support the right side prompts. So that explains why the default shell theme didn't work. I'm gonna go ahead and use the default_leftonly theme.

Are you using bash or another shell. If the former then probably that is the reason why it is not working for you as well.

I am using zsh and not bash. Had no time to look this issue further but it's still there. As you also noticed by using default_leftonly.json then the branches appear on the left, but with the normal default they do not.

same issue on mac os sierra, +1

Just installed powerline on my Arch and can confirm that default theme doesn't show git branches. Switching to default_leftonly theme fixes the problem.

Same issue with zsh.
Solved by killing all hanging powerline-daemon processes.

Changing to default_leftonly was necessary for me as well, and since I otherwise had no need for or interest in customization, and the docs are mostly geared towards that, I ended up only creating a config file to change the theme: https://github.com/powerline/powerline/issues/186#issuecomment-247810572 and powerline-daemon -q --replace after to apply the config (note the -q here to spawn it in the background!).

I changed my theme for vim to default_leftonly and still nothing...

I also struggled quite a lot to figure out the right configuration. Once getting it right, I wrote this Article guiding one through the setup of powerline. I hope it helps.

Was this page helpful?
0 / 5 - 0 ratings