跳转到主要内容

为xonsh提供的另一个异步提示支持的powerline主题。

项目描述

Powerline3

为xonsh提供的另一个类似powerline的异步提示。

为什么还要再一个?

  • 它使用 $PROMPT_FIELDS,不需要单独的函数和渲染器。自从添加了 $PROMPT_TOKENS_FORMATTER 以来,可以使用现有的函数集来模拟xonsh提示的powerline主题。
  • 异步提示模式也能正常工作。

安装

使用pip进行安装

xpip install xontrib-powerline3
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-powerline3

用法

xontrib load powerline3 prompt_ret_code

# the foreground/background colors of the prompt-fields can be configured as below. 
# This works for custom fields as well
# The format is `<prompt-field-name>__pl_colors`. It can be a function returning `tuple[str, str]`
# or set tuples directly as below.
$PROMPT_FIELDS["cwd__pl_colors"] = ("WHITE", "CYAN")

# choose the powerline glyph used
$POWERLINE_MODE = "powerline" # if not set then it will choose random
# available modes: round/down/up/flame/squares/ruiny/lego

# define the prompts using the format style and you are good to go
$PROMPT = "".join(
    [
        "{vte_new_tab_cwd}",
        "{cwd:{}}",
        "{gitstatus:{}}",
        "{ret_code}",
        "{background_jobs}",
        os.linesep,
        "{full_env_name: 🐍{}}",
        "$",
    ]
)
$RIGHT_PROMPT = "".join(
    (
        "{long_cmd_duration: ⌛{}}",
        "{user: 🤖{}}",
        "{hostname: 🖥{}}",
        "{localtime: 🕰{}}",
    )
)

额外的PROMPT_FIELDS

1. full_env_name

  • env_name
    • .venv 时,显示父文件夹的名称
    • 包含 -py3.* 时(当它是poetry创建时)仅显示项目名称部分

2. background_jobs

  • 显示正在运行的后台作业数量

示例

screenshot.png

致谢

此软件包是用 xontrib cookiecutter模板 创建的。

类似项目

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

xontrib-powerline3-0.3.17.tar.gz (8.4 kB 查看哈希值)

上传时间 源代码

构建分发

xontrib_powerline3-0.3.17-py3-none-any.whl (9.3 kB 查看哈希值)

上传时间 Python 3

由以下支持