Powerline: “在上方”外壳程序段在多行设置中与左侧对齐

创建于 2016-07-29  ·  7评论  ·  资料来源: powerline/powerline

我正在用来自tmux的鱼来运行电力线。 我尝试设置多行shell提示符,并在fish和zsh上收到以下行为:

selection_009

我尚未尝试在VM中进行复制,因此,如果有明显的事情我做错了,请指出。

如果有帮助,这是env $POWERLINE_COMMAND shell right | xxd的输出:

00000000: 1b5b 306d                                .[0m

这是鱼的提示:

$ 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"

最小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

最小.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

外壳: fish v2.3.1zsh 5.2
Python: 3.5.2
操作系统:Manjaro(Arch Linux衍生版)

$ 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

最有用的评论

只是给像我这样的Google员工的便条。
填充段示例:

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

所有7条评论

您缺少填充程序段。 正确的线段在设计上不会与右侧对齐,应该由填充线段对齐。 在Vim配置中可以看到示例。

你好@ ZyX-I
我如何进行填充物细分? 是否有一个特定的部分充当填充符? 以及如何使它看起来像“透明”的意思,看起来像什么都没有写

@Javiergg填充段的示例在Vim主题中。 没有“透明”选项,您需要创建一个高亮组,该高亮组的背景与终端的其余部分相同,并将其用作填充物。

找到他们。 非常感谢@ ZyX-I
一个问题,尽管没有“透明”颜色,是否可以“检测”终端背景颜色或将其用作系统变量?

@Javiergg没有这样的选择。 您可以尝试使用颜色0,如果我没有记错的话,在尝试启用24位着色之前,它应该可以按需要工作。

只是给像我这样的Google员工的便条。
填充段示例:

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

大家好,谢谢您提出的非常棒的电力线构想。
是否有可能看到语言env的特殊部分? 如ruby和rvm,python和django等...可能是ruby / python / perl / other -version的图标以及rails的rvm位置...
我认为应该有办法做到这一点,也许已经有一个细分市场可以证明这一点。
你能在这件事上阻止我吗? (到目前为止,我还没有在archlinux操作系统上拥有最好的zsh-powerline shell,对此我感到非常高兴)

此页面是否有帮助?
0 / 5 - 0 等级