Try Starship (prompt)

Page content

Follow the official document.

https://starship.rs

Install

Pre-requirement: nerd font

Download ttf files and place under ~/.fonts, and reboot.

Check my fonts:

$ fc-list
...
/home/atlex00/.fonts/JetBrains Mono Medium Nerd Font Complete Windows Compatible.ttf: JetBrainsMono NF:style=Medium,Regular
...

If you want to install the fonts system-wide, place them under /usr/local/share/fonts.

Install Startship prompt

Here is the full log:

$ sh -c "$(curl -fsSL https://starship.rs/install.sh)"

  Configuration
> Bin directory: /usr/local/bin
> Platform:      unknown-linux-musl
> Arch:          x86_64

> Tarball URL: https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-musl.tar.gz
? Install Starship latest to /usr/local/bin? [y/N] y
! Escalated permissions are required to install to /usr/local/bin
[sudo] password for atlex00: 
> Installing Starship as root, please wait…
βœ“ Starship installed

> Please follow the steps for your shell to complete the installation:
  bash
  Add the following to the end of ~/.bashrc:

	eval "$(starship init bash)"

  zsh
  Add the following to the end of ~/.zshrc:

	eval "$(starship init zsh)"

  ion
  Add the following to the end of ~/.config/ion/initrc:

	eval $(starship init ion)

  tcsh
  Add the following to the end of ~/.tcshrc:

	eval `starship init tcsh`

  xonsh
  Add the following to the end of ~/.xonshrc:

	execx($(starship init xonsh))

  fish
  Add the following to the end of ~/.config/fish/config.fish:

	starship init fish | source

  elvish
  Warning Only elvish v0.15 or higher is supported.
  Add the following to the end of ~/.elvish/rc.elv:

	eval (starship init elvish)

  nushell
  Warning This will change in the future.
  Only nu version v0.33 or higher is supported.
  You can check the location of this your config file by running config path in nu
  Add the following to the end of your nu config file.:

	startup = [
          "mkdir ~/.cache/starship",
          "starship init nu | save ~/.cache/starship/init.nu",
          "source ~/.cache/starship/init.nu"
        ]
        prompt = "starship_prompt"

  PowerShell
  Add the following to the end of Microsoft.PowerShell_profile.ps1:
  You can check the location of this file by querying the $PROFILE variable in PowerShell.
  Typically the path is ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 or ~/.config/powershell/Microsoft.PowerShell_profile.ps1 on -Nix.

	Invoke-Expression (&starship init powershell)

Follow the instruction (add the line in ~/.bashrc)

eval "$(starship init bash)"

After restart my terminal, here is the default prompt (Python version, AWS, and GCP configurations):

~ via 🐍 v3.9.7 on ☁️  (eu-central-1) on ☁️  myemail@gmail.com(us-west1) 
❯ 

Customize

https://starship.rs/config/#prompt

I deleted Python version, AWS, and GCP configuration:

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

~/.config/starship.toml:

# Inserts a blank line between shell prompts
add_newline = true

# Replace the "❯" symbol in the prompt with "➜"
[character]                            # The name of the module we are configuring is "character"
success_symbol = "[➜](bold green)"     # The "success_symbol" segment is being set to "➜" with the color "bold green"

# Disable the package module, hiding it from the prompt completely
[package]
disabled = true

[aws]
disabled = true

[gcloud]
disabled = true

[python]
disabled = true

~/.bashrc:

export STARSHIP_CONFIG=~/.config/starship.toml