Powerline: "Above right" shell segments align to the left on multiline setup

Created on 29 Jul 2016  ·  7Comments  ·  Source: powerline/powerline

I'm running Powerline with fish from tmux. I tried setting up a multiline shell prompt and received the following behavior on both fish and zsh:

selection_009

I haven't yet tried to reproduce in a VM, so if there's an obvious thing I'm doing wrong, please point it out.

If it helps, here's the output of env $POWERLINE_COMMAND shell right | xxd:

00000000: 1b5b 306d                                .[0m

And here are the fish prompts:

$ type fish_prompt                                                                                                                        
fish_prompt is a function with definition
function fish_prompt
    env $POWERLINE_COMMAND shell aboveleft --last-exit-code=$status --last-pipe-status=$status --jobnum=(jobs -p | wc -l) --renderer-arg=client_id=12917 --width=$_POWERLINE_COLUMNS --renderer-arg=mode=$fish_bind_mode --renderer-arg=default_mode=$_POWERLINE_DEFAULT_MODE
end
$ type fish_right_prompt                                                                                                                  
fish_right_prompt is a function with definition
function fish_right_prompt
    env $POWERLINE_COMMAND shell right --last-exit-code=$status --last-pipe-status=$status --jobnum=(jobs -p | wc -l) --renderer-arg=client_id=12917 --width=$_POWERLINE_COLUMNS --renderer-arg=mode=$fish_bind_mode --renderer-arg=default_mode=$_POWERLINE_DEFAULT_MODE
    echo -n " "
end

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

{
    "segments": {
        "above": [
            {
                "left": [
                    {
                        "function": "powerline.segments.common.net.hostname",
                        "priority": 10
                    },
                    {
                        "function": "powerline.segments.common.env.user",
                        "priority": 30
                    },
                    {
                        "function": "powerline.segments.shell.cwd",
                        "priority": 10
                    },
                    {
                        "function": "powerline.segments.shell.jobnum",
                        "priority": 20
                    }
                ],
                "right": [
                    {
                        "function": "powerline_gitstatus.gitstatus",
                        "priority": 40
                    },
                    {
                        "function": "powerline.segments.common.time.date",
                        "name": "time",
                        "args": {
                            "format": "%H:%M:%S",
                            "istime": true
                        }
                    },
                    {
                        "function": "powerline.segments.shell.last_pipe_status",
                        "priority": 10
                    },
                    {
                        "function": "powerline.segments.common.env.virtualenv",
                        "priority": 50
                    }
                ]
            }
        ],
        "left": [
            {
                "function": "powerline.segments.shell.mode"
            },
            {
                "function": "powerline.segments.shell.last_pipe_status",
                "priority": 10
            },
            {
                "function": "powerline.segments.common.time.date",
                "args": {
                    "format": "$"
                }
            }
        ],
        "right": [
        ]
    }
}

~/.tmux.conf:

set -g default-terminal "screen-256color"
POWERLINE_CONFIG_PATHS="$HOME/.config/powerline"
run-shell "powerline-daemon -q"
source "/usr/lib/python3.5/site-packages/powerline/bindings/tmux/powerline.conf"

Minimal config.fish:

set -gx POWERLINE_CONFIG_PATHS "$HOME/.config/powerline"

set fish_function_path $fish_function_path "/usr/lib/python3.5/site-packages/powerline/bindings/fish"
powerline-setup

source /usr/share/fish/functions/fzf.fish

Minimal .zshrc:

HYPHEN_INSENSITIVE="true"
DISABLE_AUTO_UPDATE="true"

if [[ -r /usr/lib/python3.5/site-packages/powerline/bindings/zsh/powerline.zsh ]]; then
    source /usr/lib/python3.5/site-packages/powerline/bindings/zsh/powerline.zsh
fi

Shell: fish v2.3.1, zsh 5.2
Python: 3.5.2
OS: Manjaro (Arch Linux derivative)

$ pip show powerline-status

---
Metadata-Version: 1.1
Name: powerline-status
Version: 2.4
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: [email protected]
License: MIT
Location: /usr/lib/python3.5/site-packages
Requires: 
Classifiers:
  Development Status :: 5 - Production/Stable
  Environment :: Console
  Environment :: Plugins
  Intended Audience :: End Users/Desktop
  License :: OSI Approved :: MIT License
  Natural Language :: English
  Operating System :: Microsoft :: Windows
  Operating System :: POSIX
  Programming Language :: Python :: 2.6
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3.2
  Programming Language :: Python :: 3.3
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: Implementation :: CPython
  Programming Language :: Python :: Implementation :: PyPy
cshell sconfiguration error bug

Most helpful comment

Just a note for googlers like me.
Example of filler segment:

{
    "type": "string",
    "highlight_groups": ["background"],
    "draw_soft_divider": false,
    "draw_hard_divider": false,
    "width": "auto"
}

All 7 comments

You are missing filler segment. Right segments do not get aligned to the right by design, they are supposed to be aligned by filler segments. Examples may be seen in Vim configuration.

Hello @ZyX-I
How can I make a filler segment? Is there an specific segment that behaves as a filler? And how can I make it look like the "transparent" meaning look like there was nothing written on it

@Javiergg The examples of filler segments are in Vim themes. There is no “transparent” option, you need to create a highlight group which has the same background as the rest of the terminal and use that for the filler.

Found them. Thank you very much @ZyX-I
One question, although there is no "transparent" colour, would it be possible to "detect" the terminal background colour or use it as a system variable?

@Javiergg There is no such option. You may try using color 0, if I am not mistaking this should work like you need until you try enabling 24-bit coloring.

Just a note for googlers like me.
Example of filler segment:

{
    "type": "string",
    "highlight_groups": ["background"],
    "draw_soft_divider": false,
    "draw_hard_divider": false,
    "width": "auto"
}

Hello all, and thank you for this very nice powerline idea.
Is it possible to see a special segment for language env ? like ruby and rvm, python and django, etc... maybe an icon for ruby/python/perl/other -version and the rvm position for rails...
i think it should have a way to do that, and maybe there is allready a segment existing for show this.
could you halp me on that please ? (i'm not so far to have the best zsh-powerline shell on my archlinux OS, i'm very happy)

Was this page helpful?
0 / 5 - 0 ratings