For the manual approach, git provides a shell script to generate the env var __git_ps1 for this very purpose.[1]
[1]: https://git-scm.com/book/id/v2/Appendix-A%3A-Git-in-Other-En...
I think a manual approach is covered with vim ;)
Very cool, had no idea!
See also:
* LiquidPrompt [0] (I'm a former maintainer)
* angel-PS1 [1]: my pet project. Shell prompt code is generated at startup time from Perl code, and uses a Perl angel (not daemon) to get system information.
There's one prompt in ZSH, the adam2 prompt[1], that I completely fell in love with due to the automatic horizontal rule since it makes tracing histories so much easier when dealing with long-scrolling outputs. I've never been able to find a similar feature in another prompt/shell, nor have I had the inclination to try and replicate it, but I'd be much more inclined to switch shells/try new prompts if that were available.
Re:Bash PS1 Generator
by indianboy42 on Friday June 25, 2021 @06:40AM
(#27629066)
The tide prompt for fish has an option to add a horizontal rule and spaces between each command
double click an element to change the color
Aha! Thank you!
I've shared it elsewhere too, but I made something similar a few years ago which provides what you were after:
* As an idea, this is excellent. It's intuitive to use and provides full instructions on how to implement
* Putting an element in any other position than the end of the prompt is fiddly.
* I'd love for the option to to be able to colour elements.
* More advanced or exotic element types such as Git Branch would be excellent (Not sure if Bash supports this, but I've seen it in some shells)