The customization of a prompt is very often just some "optical enhancements". Some colors here and maybe some behavior there. If you want to have additional functionality, you may want to have a look at Starship. A blazing fast prompt with lots of cool features.
The Starship Prompt is fast, customizable and packed with features. It also supports multiple shells, but I will focus on Bash for this article.
Other prompts offer things like a Git indicator or coloring, based on the user. Starship can do the same, but also much more. It can detect various settings and the context of your working directory to show all kind of things like:
- AWS, Azure, Google Cloud contexts
- Python, NodeJS, Ruby environments
- System Status like Battery level, Background Jobs or Command Duration
- Git status
- Kubernetes context
Fast and minimal
By default, the prompt is as fast (or even faster) than Powerline-Go. This makes it a breeze to use, since you will never wait that your prompt is ready.
It comes in a really minimal way. All modules can be enabled or disabled to your personal liking.
When it comes to customizations, you can tweak the behavior, modules and optical setup in nearly every way. Even better, you can do this with a quite simple TOML configuration file.
So, how do you get it installed and running?
Starship uses so called Nerdfonts to display symbols and enhanced characters. Nerdfonts are patched sets of Fonts that allow these special characters. As a prerequisite, you should ensure that one is installed on your system and your terminal is configured to use these.
I opted for FiraCode. You just need to download the ZIP archive and install one of the fonts, that you like. Afterwards, you can configure the font in your Terminal. You can also configure the new Font via GNOME Tweaks, so it is used for all Monospace characters.
Starship is already packaged for Fedora and the installation is just a command away.
# Install starship $ sudo dnf install starship
Afterwards, you can enable the prompt for your current user with a simple addition to the end of your
Afterwards, you can start to enjoy and customize your prompt.
By default, Starship comes with several modules enabled and looks pretty minimal. As already stated, you can tune this with a single configuration file. Let's explore this a bit.
First, you need to create a configuration file in your home directory.
# Create the directory (if not existing) $ mkdir ~/.config # Create the starship configuration file $ touch ~/.config/starship.toml
Afterwards, you can put your configurations in there and after writing the file, the changes will be effective immediately. The below snippet is my current configuration.
# Keep the newline after each prompt add_newline = true # Show the battery level if under 20% [[battery.display]] threshold = 20 # Show the regular bash prompt symbols [character] success_symbol = "[\\$](bold green)" error_symbol = "[\\$](bold red)" # Enable the Kubernetes module [kubernetes] disabled = false
You can configure really everything to your liking, and all modules are documented on the Starship website.
In case you want to add your own custom functions, you can do this as described in the advanced configuration.
Configuring everything from scratch can be a huge effort. If you need some ideas, the Starship website provides some cool presets to start from.
Docs & Links
Here you can find all the links that were helpful for me.
Which prompt do you use? How have you customized it? I would love to get a screenshot or configuration preset that demonstrates your prompt.