All Projects → anki-code → xontrib-prompt-bar

anki-code / xontrib-prompt-bar

Licence: BSD-2-Clause license
The bar prompt for xonsh shell with customizable sections and Starship support.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to xontrib-prompt-bar

xontrib-output-search
Get identifiers, paths, URLs and words from the previous command output and use them for the next command in xonsh shell.
Stars: ✭ 26 (-3.7%)
Mutual labels:  console, xonsh, xontrib
awesome-xonshrc
👓 🐚 Make your xonsh RC file installable with awesome snippets of code.
Stars: ✭ 43 (+59.26%)
Mutual labels:  iterm2, xonsh, xontrib
Terminal
The new Windows Terminal and the original Windows console host, all in the same place!
Stars: ✭ 79,371 (+293866.67%)
Mutual labels:  console, cmd, windows-terminal
ttdl
TTDL - Terminal Todo List Manager
Stars: ✭ 91 (+237.04%)
Mutual labels:  console, cmd
Iterm2 Color Schemes
Over 250 terminal color schemes/themes for iTerm/iTerm2. Includes ports to Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTerminal, Microsoft's Windows Terminal, Visual Studio, Alacritty
Stars: ✭ 20,828 (+77040.74%)
Mutual labels:  iterm2, windows-terminal
Dotfiles
Configurations for the tools I use every day
Stars: ✭ 898 (+3225.93%)
Mutual labels:  iterm2, prompt
apollo-zsh-theme
Heavily customizable, compatible, and fast ZSH theme framework.
Stars: ✭ 64 (+137.04%)
Mutual labels:  prompt, shell-theme
Mitype
Typing speed test in terminal
Stars: ✭ 241 (+792.59%)
Mutual labels:  console, cmd
enquirer
Stylish, intuitive and user-friendly prompts, for Node.js. Used by eslint, webpack, yarn, pm2, pnpm, RedwoodJS, FactorJS, salesforce, Cypress, Google Lighthouse, Generate, tencent cloudbase, lint-staged, gluegun, hygen, hardhat, AWS Amplify, GitHub Actions Toolkit, @airbnb/nimbus, and many others! Please follow Enquirer's author: https://github.…
Stars: ✭ 6,523 (+24059.26%)
Mutual labels:  console, prompt
bliss-zsh
A delicate Zsh theme that injects color without overwhelming your workspace
Stars: ✭ 20 (-25.93%)
Mutual labels:  iterm2, iterm2-theme
guri
A simple and fast Oh-My-Zsh theme
Stars: ✭ 19 (-29.63%)
Mutual labels:  prompt, shell-theme
Spaceship Prompt
🚀⭐ A Zsh prompt for Astronauts
Stars: ✭ 15,748 (+58225.93%)
Mutual labels:  prompt, shell-theme
Pure
Pretty, minimal and fast ZSH prompt
Stars: ✭ 10,891 (+40237.04%)
Mutual labels:  prompt, shell-theme
Terminus
Terminus, a terminal for Atom! - Looking for collaborators hop in, at your next bus stop :-)
Stars: ✭ 49 (+81.48%)
Mutual labels:  iterm2, cmd
Xonsh
🐚 Python-powered, cross-platform, Unix-gazing shell
Stars: ✭ 5,327 (+19629.63%)
Mutual labels:  prompt, xonsh
Monokai-Flat
A material monokai color scheme for Visual Studio, Visual Studio Code, JetBrains IDE and some terminal
Stars: ✭ 21 (-22.22%)
Mutual labels:  cmd, windows-terminal
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+16277.78%)
Mutual labels:  xonsh, xontrib
lambda-pure
Pretty, minimal and fast ZSH prompt, with NodeJS version
Stars: ✭ 107 (+296.3%)
Mutual labels:  prompt, shell-theme
ayu-iTerm
ayu color themes for iTerm
Stars: ✭ 120 (+344.44%)
Mutual labels:  iterm2, iterm2-theme
Inquirer.cs
A collection of common interactive command line user interfaces. Port of Inquirer.js
Stars: ✭ 26 (-3.7%)
Mutual labels:  console, prompt

The bar prompt for the xonsh shell with customizable sections.

[Demo] Screenshot made in Konsole with $XONSH_COLOR_STYLE = "paraiso-dark".

If you like the idea of bar theme click on the repo and tweet.

Features:

  • Zero dependencies. You don't need to install additional packages.

  • Clear concept. The bar is a delimiter and information panel. Three attention aspects: command line and path, output, sections with additional info.

  • The command beginning has fixed position to have a large command line every time and avoid mess of attention.

  • The sections placed to right but not in the same line as command and it allows you to copy the command and output without environmental disclosure.

  • Full customization. Change colors, add sections with info you need easily with Python.

Install

xpip install -U xontrib-prompt-bar
echo 'xontrib load prompt_bar' >> ~/.xonshrc
# Reload xonsh

Default theme

$XONTRIB_PROMPT_BAR_THEME = {
    'left': '{hostname}{user}{cwd_abs#accent}',
    'right': '{env_name#strip_brackets#section}{gitstatus#nocolorx#section}{date_time_tz}',
    'bar_bg': '{BACKGROUND_#323232}',
    'bar_fg': '{#AAA}',
    'section_bg': '{BACKGROUND_#444}',
    'section_fg': '{#CCC}',
    'accent_fg': '{BOLD_#DDD}',
}
xontrib load prompt_bar

Use cases

Customize the fields

Supported fields:

To customize the appearance of the fields on the bar you can use wrappers and chaining them:

$XONTRIB_PROMPT_BAR_RIGHT = '{hostname#accent#section} {gitstatus#nocolorx}'
xontrib load prompt_bar

Builtin wrappers:

  • section - add backlight for the text.
  • accent - bold font and lighter color.
  • noesc - remove the ANSI escape characters (colors).
  • strip - remove the white spaces in the begin and end.
  • strip_brackets - remove the white spaces in the begin and end and then remove the brackets ()[]{} if the text begins from brackets.
  • nonl - replace the new line symbols to spaces.
  • nocolorx - remove the xonsh color tags i.e. {RED} or {#00ff00}.

To create your own fields and wrapper see the section below.

Add custom fields and wrappers

How to add two new fields called my_left_custom and my_right_custom and one new wrapper called brackets.

$PROMPT_FIELDS['my_left_custom'] = 'Hello left!'
$PROMPT_FIELDS['my_right_custom'] = lambda: '>'*3 + ' {YELLOW}Hello right!'

$XONTRIB_PROMPT_BAR_WRAPPERS = {
    'brackets': lambda v: f'[{v}]'
}

$XONTRIB_PROMPT_BAR_LEFT = '{hostname}{user}{cwd_abs#accent}{my_left_custom#brackets}'
$XONTRIB_PROMPT_BAR_RIGHT = '{my_right_custom#section}{env_name#strip_brackets#section}{gitstatus#nocolorx#section}{date_time_tz}'

xontrib load prompt_bar

Result:

[Demo custom fields]

Themes and colors

To change the bar colors there is setting the theme:

$XONTRIB_PROMPT_BAR_THEME = {
    'left':       '{hostname}{user}{cwd_abs#accent}',
    'right':      '{env_name#strip_brackets#section}{gitstatus#nocolorx#section}{date_time_tz}',
    'bar_bg':     '{BACKGROUND_#FF0000}',
    'bar_fg':     '{#AAA}',
    'section_bg': '{BACKGROUND_#444}',
    'section_fg': '{#CCC}',
    'accent_fg':  '{BOLD_#DDD}',
}
xontrib load prompt_bar

To choose the colors there is HTML Color Picker.

Using Starship cross-shell prompt to rendering right sections

Barship using xontrib-prompt-starship:

# First of all create a starship config to return sections in one line
$XONTRIB_PROMPT_STARSHIP_RIGHT_CONFIG = "~/.config/starship_xonsh_right.toml"
$XONTRIB_PROMPT_STARSHIP_REPLACE_PROMPT = False
$XONTRIB_PROMPT_BAR_RIGHT = '{starship_right#noesc#nonl#strip}'
xontrib load prompt_starship prompt_bar

Result:

Prompt bar with starship sections.

Using xontrib-cmd-durations

The xontrib-cmd-durations is to send notification once long-running command is finished and also show the execution time. Usage example:

# Add `{long_cmd_duration}` section
$XONTRIB_PROMPT_BAR_RIGHT = '{long_cmd_duration}{screens#section}{env_name#strip_brackets#section}{date_time_tz}'
xontrib load cmd_done

Additional links

Known issues

Spaces in the copied and pasted command line

Please update prompt_toolkit to 3.0.7+ version via python -m pip install -U prompt_toolkit.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].