I assume that you know what powerline is, if not, you can read about it here. In this post, I will show how to use it to get a better bash prompt.
Let’s install it.
sudo dnf install powerline
Now you have to configure bash to use powerline by default. Edit ~/.bashrc
file and add at the end:
if [ -f `which powerline-daemon` ]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.shfi
The newly opened terminal will use powerline.
Now, let’s add information about current git branch.
Create powerline configuration file.
mkdir -p ~/.config/powerline
Set theme.
cat <<-'EOF' > ~/.config/powerline/config.json{ "ext": { "shell": { "theme": "default_leftonly" } }}EOF
Load new configuration
powerline-daemon --replace
Bash prompt should display currently used git branch.