I saw this in a Github video and would like the same right-aligned prompt in my shell.
How can I accomplish it?
or even better
Which prompt is used here?
You do this by setting the RPROMPT
zsh variable. Example: to display the current time,
RPROMPT='$(date +%T)'
Make sure the promptsubst
option is set by looking at the output of setopt
. If it isn't, use setopt promptsubst
in your .zshrc
or equivalent.
In your case, use the appropriate git
command telling you the branch.
For the gory details, read man zshmisc
, especially the section EXPANSION OF PROMPT SEQUENCES
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With