Customize_bash prompt using Starship

My bash prompt was ok since my last post on this subject in october 2022. But I’d like to customize it a little more. So I decide to install a shell prompt program. There are many softwares availables :

  • LiquidPrompt
  • Pure
  • Oh-My-Posh
  • Starship
  • PowerLevel10k …

I’ve tested the following prompts (because they can run on the bash shell which is installed on my machine):

  • LiquidPrompt
  • Starship
  • Oh-My-Posh

And after some tests I’ve decide to choose Starship.

I’ve installed it using the command : pacman -S starship ttf-firacode-nerd

I’ve also installed the firacode nerd font to get additional symbols in the terminal.

Next I create the config file using a preset : starship preset nerd-font-symbols -o ~/.config/starship.toml

And add starship at the end of my .bahsrc file :

# ~/.bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
eval "$(starship init bash)"

It looks nice but i’ve decide to make some tweaks. My config file now starts like this :

# ~/.config/starship.toml

add_newline = true
format = """
$os [$username@$hostname](bold blue) $directory$rust[❯](bold yellow)

I’ve modified the os,username,hostname,directory variables in the file to make everything work perfectly. It was pretty easy thanks to the documentation.