Skip to main content

Yet another powerline theme for xonsh with async prompt support.

Project description

Powerline3

Yet another powerline theme for xonsh with async prompt support.

Note:

This depends on xonsh's unreleased version (master branch will work. or in future >0.9.24)

Why another one?

  • It uses $PROMPT_FIELDS and no need to have a separate functions and renderer. Since the addition of $PROMPT_TOKENS_FORMATTER it is possible to use the existing set of functions to emulate powerline theme for xonsh prompts.
  • Async prompt mode works as well.

Installation

To install use pip:

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

Usage

xontrib load powerline3

# these are the default colors and they are configurable.
$PROMPT_FIELD_COLORS = {
    "cwd": ("WHITE", "CYAN"),
    "gitstatus": ("WHITE", "BLACK"),
    "ret_code": ("WHITE", "RED"),
    "full_env_name": ("white", "green"),
    "hostname": ("white", BLUE),
    "localtime": ("#DAF7A6", "black"),
}

# 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: 🕰{}}",
    )
)

Extra PROMPT_FIELDS

1. full_env_name

  • When the env_name is
    • .venv show the name of the parent folder
    • contains -py3.* (when it is poetry created) shows the project name part alone

2. background_jobs

  • show number of running background jobs

3. py_pkg_info

  • show python package name-version if current directory has poetry-pyproject.toml

Examples

screenshot.png

Credits

This package was created with xontrib cookiecutter template.

Similar Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-powerline3-0.3.5.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

xontrib_powerline3-0.3.5-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-powerline3-0.3.5.tar.gz.

File metadata

  • Download URL: xontrib-powerline3-0.3.5.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.13.11-1-MANJARO

File hashes

Hashes for xontrib-powerline3-0.3.5.tar.gz
Algorithm Hash digest
SHA256 1fa6b5a974e4cbac5e1ee2b0988c4e89fdee215e046bb995510c4875d0c4b64f
MD5 9eb18d193b986c21f27d25090d3b397f
BLAKE2b-256 001ee9137fb7899bd912f8e89b4d2b26c58c78fa19839429249666dcea21287c

See more details on using hashes here.

File details

Details for the file xontrib_powerline3-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_powerline3-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4e165371e179de8cc48eef81ec218c3b3d338c68da7877b2aa70d2361cdba48a
MD5 2b6a5d1d2c7e7fc75eb5379c3d84f260
BLAKE2b-256 78e6af26bdefec3cdb4b1d5b09857d1460ee25adf83c13d825d3ee5027f07238

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page