anki-code / xontrib-prompt-starship

Starship cross-shell prompt in xonsh shell.
MIT License
54 stars 8 forks source link
shell-prompt starship xonsh xonsh-prompt xontrib

Starship cross-shell prompt in xonsh shell.

If you like the idea click ⭐ on the repo and tweet.

Additional features:

Installation

To install use pip:

# You already have Starship installed. Then:
xpip install xontrib-prompt-starship
# or: xpip install -U git+https://github.com/anki-code/xontrib-prompt-starship

Usage

xontrib load prompt_starship

Recommendation

We suggest to use @ character to remember about you're using xonsh syntax and to potentially spread the word about xonsh if you make a screenshot or show your terminal to friends or collegues:

mkdir -p ~/.config/ && echo @("""
[character]
success_symbol = "[@](bold green)"
error_symbol = "[@](bold red)"
""".strip()) > ~/.config/starship_xonsh.toml

$STARSHIP_CONFIG = '~/.config/starship_xonsh.toml'
xontrib load prompt_starship

Configuration

You can set the different starship configs for left, right and bottom parts of prompt when your shell type is prompt-toolkit:

$XONTRIB_PROMPT_STARSHIP_LEFT_CONFIG = "~/.config/starship_xonsh_left.toml"
$XONTRIB_PROMPT_STARSHIP_RIGHT_CONFIG = "~/.config/starship_xonsh_right.toml"
$XONTRIB_PROMPT_STARSHIP_BOTTOM_CONFIG = "~/.config/starship_xonsh_bottom.toml"
xontrib load prompt_starship

In case of using starship as part of another prompt you can add starship prompt to $PROMPT_FIELDS without replacing the current prompt:

$XONTRIB_PROMPT_STARSHIP_REPLACE_PROMPT = False
xontrib load prompt_starship
print($PROMPT_FIELDS['starship_left']())

Prompt bar with starship:

Prompt bar with starship sections.

Known issues

Credits