Skip to content

Instantly share code, notes, and snippets.

@azmarifdev
Last active June 12, 2024 22:31
Show Gist options
  • Save azmarifdev/b74f508c07d0af6f4edbbb6e480b53c1 to your computer and use it in GitHub Desktop.
Save azmarifdev/b74f508c07d0af6f4edbbb6e480b53c1 to your computer and use it in GitHub Desktop.
Starship Advance Config Docs

Starship

CROSS-SHELL-PROMPT

App Screenshot

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

  • Fast: it's fast – really really fast! πŸš€
  • Customizable: configure every aspect of your prompt.
  • Universal: works on any shell, on any operating system.
  • Intelligent: shows relevant information at a glance.
  • Feature-rich: support for all your favorite tools.
  • Easy: quick to install – start using it in minutes.

πŸš€ Installation

Prerequisites

Step 1. Install Starship

Select your operating system from the list below to view installation instructions:

  • Linux:

First, install curl:

  • Ubuntu/Mint:
sudo apt install curl
  • Fedora:
sudo dnf install curl
  • Manjaro/Arch:
sudo pacman -S curl

Then Install the latest version for your system:

curl -sS https://starship.rs/install.sh | sh

Alternatively, install Starship using any of the following package managers:

Distribution Instructions
Any cargo install starship --locked
Any conda install -c conda-forge starship
Any brew install starship
Alpine Linux 3.13+ apk add starship
Arch Linux pacman -S starship
CentOS 7+ dnf copr enable atim/starship dnf install starship
Gentoo emerge app-shells/starship
Manjaro pacman -S starship
NixOS nix-env -iA nixpkgs.starship
openSUSE zypper in starship
Void Linux xbps-install -S starship
  • MacOS

Install the latest version for your system:

curl -sS https://starship.rs/install.sh | sh
  • Windows

Install the latest version for your system with the MSI-installers from the releases section.

Install Starship using any of the following package managers:

Repository Instructions
crates.io cargo install starship --locked
Chocolatey choco install starship
conda-forge conda install -c conda-forge starship
Scoop scoop install starship
winget winget install --id Starship.Starship

Step 2. Set up your shell to use Starship

Configure your shell to initialize starship. Select yours from the list below:

  • Bash

Add the following to the end of ~/.bashrc:

eval "$(starship init bash)"
  • Cmd

You need to use Clink (v1.2.30+) with Cmd. Create a file at this path %LocalAppData%\clink\starship.lua with the following contents:

load(io.popen('starship init cmd'):read("*a"))()
  • Fish

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

starship init fish | source
  • Nushell

Add the following to the end of your Nushell env file (find it by running $nu.env-path in Nushell):

mkdir ~/.cache/starship
starship init nu | save -f ~/.cache/starship/init.nu

And add the following to the end of your Nushell configuration (find it by running $nu.config-path ):

use ~/.cache/starship/init.nu
  • PowerShell

Add the following to the end of your PowerShell configuration (find it by running $PROFILE ):

Invoke-Expression (&starship init powershell)
  • Zsh

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

eval "$(starship init zsh)" 

Step 3. Configure Starship

Start a new shell instance, and you should see your beautiful new shell prompt. If you're happy with the defaults, enjoy!

If you're looking to further customize Starship:

You can use my advanced config file

To get started configuring starship, create the following file: ~/.config/starship.toml.

~/.config && touch ~/.config/starship.toml && sudo nano starship.toml

Then copy all config lines and paste in starship.toml file then save it.

# ~/.config/starship.toml

# NOTE:
# Install font awesome for better effect, if not working i guess try install some emojis, that would be helpful.

add_newline = true

[character]
success_symbol = "[➟](bold blue) "
error_symbol = "[βœ—](bold red) "

# Hide the username. The username will only show in certain scenarios
[username]
disabled = false

[hostname]
ssh_only = false
format =  "[$hostname](bold #ee00ff) [❯](bold green) "
trim_at = ".companyname.com"
disabled = false

[directory]
truncation_length = 5
truncate_to_repo = true
format = "[$path]($style)[$read_only]($read_only_style) "
read_only = " πŸ”’"
read_only_style = "red"
style = "bold italic blue"

[cmd_duration]
min_time = 4
show_milliseconds = false
disabled = false
format = "[ $duration](bold yellow)"
style = "bold italic blue"

[docker_context]
format = "[$context](blue bold)"
symbol = ' '

[kubernetes]
format = 'on [☸ $context \($namespace\)](dimmed green) '
disabled = false
[kubernetes.context_aliases]
"dev.local.cluster.k8s" = "dev"
".*/openshift-cluster/.*" = "openshift"
"gke_.*_(?P<cluster>[\\w-]+)" = "gke-$cluster"

[azure]
symbol = 'ﴃ '

[aws]
symbol = " "

[conda]
symbol = "ο„Œ "

[dart]
symbol = " "

[elixir]
symbol = " "

[elm]
symbol = " "

[git_branch]
symbol = " "
truncation_length = 15
truncation_symbol = ""

[git_commit]
commit_hash_length = 4
tag_symbol = " ο°– "

[git_state]
format = '[\($state( $progress_current of $progress_total)\)]($style) '
cherry_pick = "[❯❯ PICKING](bold red)"

[git_status]
conflicted = '$ {count}⚠ '
ahead = " ${count}β˜‹ "
behind = " ${count}☊ "
diverged = " βš™${ahead_count}β˜‹ ${behind_count}☊ "
untracked = ' ${count}γ€₯ '
stashed = ' ${count}βœ‚ '
modified = ' ${count}✎ '
staged = ' ${count}⚣ '
renamed = ' ${count}βœ‘ '
deleted = ' ${count}✘ '
# up_to_date = 'βœ” '

[hg_branch]
format = "[$branch](bold purple)"
truncation_length = 15
truncation_symbol = ""

[golang]
format = "[ $version](bold cyan) "

[helm]
format = "[⎈ $version](bold white) "

[java]
symbol = "♨ "

[julia]
symbol = " "

[package]
symbol = 'βœ‡ '

[lua]
format = "[ $version](bold blue) "

[memory_usage]
symbol = " "

[nim]
symbol = " "

[nix_shell]
symbol = "ο‹œ "

[perl]
symbol = " "

[php]
symbol = " "

[python]
symbol = "ξ˜† "

[ruby]
symbol = " "

[rust]
symbol = " "

[scala]
symbol = " "

[shlvl]
symbol = "ο„  "

[swift]
symbol = "ο―£ "

[nodejs]
format = "[ $version](bold green) "
detect_files = ["package.json", ".node-version"]
detect_folders = ["node_modules"]

Follow this shortcut if you don't know how to save and exit the nano file.

(Press Ctrl + O then Press Enter to Save And Press Ctrl + X to Exit)

Official Documents

  • Starship Docs
  • Configuration – learn how to configure Starship to tweak your prompt to your liking
  • Presets – get inspired by the pre-built configuration of others

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment