Git Product home page Git Product logo

xontrib-powerline3's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.