On Mon, May 22, 2023 at 2:27 PM Stephen Gallagher <sgallagh(a)redhat.com> wrote:
On Sun, May 21, 2023 at 11:50 PM Jens-Ulrik Petersen
<petersen(a)redhat.com> wrote:
>
> In Fedora the bash prompt is not colored or highlighted by default.
...
> I think it would be nice to have a distinctive prompt by default, or at least a very
easy way to get one permanently (ie in a single command: even if that were `dnf install
bash-color-prompt` or running say `colorprompt` once).
We could put the following at the end of /etc/bashrc:
```
function _update_ps1() {
PS1="$(/usr/bin/powerline-go -modules
venv,user,host,ssh,cwd,perms,git,hg,jobs,exit -colorize-hostname
-error $? -static-prompt-indicator -newline -jobs $(jobs -p | wc -l))"
}
if [ "$TERM" != "linux" ] && [ -f
"/usr/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
```
See attached picture for what it looks like. I've been using this
setup on my machines for years and it's been super helpful. (Note that
the modules listed in the PS1 line there appear only when relevant. So
you won't see 'ssh', 'git', etc. information unless they're in
use.
I hit "send" too soon. The configuration in /etc/bashrc will do
nothing until and unless the user installs the `powerline-go` package
(or we decide to ship it by default).