anki-code / xontrib-prompt-bar

The bar prompt for xonsh shell with customizable sections and Starship support.
BSD 2-Clause "Simplified" License
48 stars 2 forks source link

Make path short in case of big path and small window #6

Open anki-code opened 1 year ago

anki-code commented 1 year ago

/long/long/long/long/long/long/path -> .../long/path

Start lines - https://github.com/anki-code/xontrib-prompt-bar/blob/fce5308375f037f227eb6058518a34724741b23c/xontrib/prompt_bar.py#L151-L152

anki-code commented 5 months ago

Example:

$PROMPT_FIELDS['cwd4'] = lambda: str(Path(*Path(__xonsh__.env['PROMPT_FIELDS']['cwd']()).expanduser().parts[-4:]))
$XONTRIB_PROMPT_BAR_LEFT = '{hostname#nolocal}{user#nolocal}{cwd4#accent}'
xontrib load prompt_bar