Starship, install this minimal prompt written in Rust

about starship

In the next article we are going to take a look at Starship. This is un prompt free and open source shell for Gnu / Linux, MacOS and Windows. It is light, fast, and highly customizable for some of the most popular shells. It is released under the ISC license and is written in Rust.

We will be able to customize everything in Starship, it is also compatible with almost all operating systems and shells such as bash, fish, zsh, powershell e ion. It can also integrate with git and show us the current battery level and state. It comes with background job indicator and Powerline font support.

If we use the default values, we will see a simple but also very useful prompt, since provides additional information only when necessary. Being highly customizable, we will be able to make it look as elegant as we want. To do this, we will find a good documentation on the configuration, in which they will tell us how to make the necessary changes.

Some features of Starship

starship running

  • It is written in Rust, and it is supposed to work with the most common shells on the most common operating systems. We will find setup instructions for Bash, Fish, Zsh, Powershell and Ion.
  • Use a Powerline font to indicate various information. It will allow us to configure any powerline character we want instead of the default symbol '❯', in addition to changing the color.
  • Solo show username if it is not the same as the logged in user, and for root / ssh sessions.
  • Git integration, it will show us the current branch of Git and the status of the repository. It can also display Node.js, Rust, Ruby, Python, and Go.
  • The indicator turns red when the last command with non-zero code exists.
  • Displays the version of the package in the current upload directory (Rust), npm (Node.js) and poetry (Python).
  • We can see the current battery level and status. We will have the possibility to set the way in which the battery levels are displayed.
  • Lets set quick orders.
  • Environment detection nix-shell.
  • It will also show us the time it took to execute the last command. We can configure the time it takes until Starship shows the time it took to execute a command.
  • Has a indicator for jobs running in the background.
  • Shows the time (disabled by default) with options to configure the time format.

These are just some of the features. They can consult more in detail from GitHub page of the project.

Install Starship Shell Prompt on Ubuntu

Installing Starship Shell Prompt on Ubuntu is an easy process. We will only have to open a terminal (Ctrl + Alt + T) and run the following command to update the list of software sources:

sudo apt update

Before proceeding with the installation, we will have to install a font powerline. Even though we could install the package fonts powerline, in this example I am going to install Fira code with the command:

install fonts fira code

sudo apt install fonts-firacode

After the previous command, we will execute the following command in the same terminal to download and use the Starship Shell Prompt installation script:

install starship on Ubuntu 20.04

curl -fsSL https://starship.rs/install.sh | bash

Initial setup

After installation, only add the startup script to your shell configuration file. As I have commented lines above, we will have different options available, such as:

  • Bash. We will have to add the following line to the end of the ~ / .bashrc file:
eval "$(starship init bash)"
  • Fish. If you use this shell, add the following to the end of ~ / .config / fish / config.fish:
starship init fish | source
  • zsh. In case you use this, add the following to the end of the ~ / .zshrc file:
eval "$(starship init zsh)"
  • Powershell. In this case we will have to add the following at the end of ~ \ Documents \ PowerShell \ Microsoft.PowerShell_profile.ps1
Invoke-Expression (&starship init powershell)

Make the change you make, after saving the corresponding file, restart terminal.

default starship

For make changes to the Starchip configuration, let's create the configuration file as shown below:

mkdir -p ~/.config && touch ~/.config/starship.toml

If you want to give a small change to the prompt, so that it looks a little different from the one we will find by default, within the file we just created, called starship.toml, we will have to add the following content:

custom starship

add_newline = false
[character]      
symbol = "➜"    
[package]
disabled = true

These are just some of the configuration options. Users can read more about setting of Starship and we can also consult your Advanced configuration. In this documentation that users are offered, they will indicate all the options that we can add.

Starship is minimal to start with, and not only does it display information when needed, it is also fast and highly customizable. To consult the information of this project, users can contact their web page.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.