This page looks best with JavaScript enabled

Consistent Prompt With Starship

 ·  ☕ 2 min read  ·  ✍️ Syed Dawood

Intro

The minimal, blazing-fast, and infinitely customizable prompt for any shell!
- starship

Reasons starship

  • It is written in rust, you can expect almost C-language like performance.
  • Starship provides consistent and identical prompt across shell, this was the biggest selling point for me.
  • Shows active git branch and repo status if navigated directory is git repository, huge time saver.
    active branch
  • Smart enough to show major programming language version based on contents of directory and virtual environment name if it is active.
    Major programming language
  • Last command status via color, green for success and red for failure
    Last command status

Installation

Fire up your favourite terminal emulator.

1
yay -S starship-bin
1
curl -fsSL https://starship.rs/install.sh | bash

Configuration

Next up, initialize startship. To do that, Update config file based on the shell in use.

1
eval "$(starship init bash)"
1
eval "$(starship init zsh)"
1
starship init fish | source

starship offers lots of bell and whistles when it cames to configuration with ability to customize every aspect of the prompt.

Use this config as a starting point. Remove/update parts to fit your taste.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[hostname]
format =  "on [$hostname](bold red) "

[git_status]
conflicted = "🏳"
ahead = "🏎💨"
behind = "😰"
diverged = "😵"
stashed = "📦"
modified = "📝"
staged = '[++\($count\)](green)'
renamed = "👅"
deleted = "🗑"


# if you are use gcloud
[gcloud]
symbol = "️🇬️ "
format = "on [$symbol$account(\\($project\\))]($style) "

Closing thoughts

After I made the switch to starship, I felt my search for creating perfect prompt is completed. It provides me consistecy, the other day I have installed powershell and first thing I did was set up starship. After a while, I was confused as to why regular linux commands are not working only to find out that I was in powershell 😄.

References

Share on

ALLSYED
WRITTEN BY
Syed Dawood
< frontend | backend | fullstack > Developer