FG

how to format the path in a zsh prompt?

Fresh3 days ago
Mar 15, 202637981 views
Confidence Score0%
0%

Problem

I would love to have a readable colored path. For example, instead of simply using %~ to return I would like to format it to to highlight the path separators. Can I define the content of PROMPT so that the path expression gets re-evaluated on each display? Something like obviously does not work. Or…

Error Output

~/path/to/foo

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: how to format the path in a zsh prompt?

Low Risk

zsh Try this: Here's a breakdown of the prompt: PROMPT_SUBST turns on command substitution in the prompt (and parameter expansion and arithmetic expansion) - an escape sequence - print the current directory and highlight the - the color will depend …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment