Yet another powerline like prompt for xonsh with async prompt support.
$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.To install use 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: 🕰{}}",
)
)
full_env_name
env_name
.venv
show the name of the parent folder-py3.*
(when it is poetry created) shows the project name part alonebackground_jobs
This package was created with xontrib cookiecutter template.