Post

Starship Prompt

Starship Prompt

Starship Prompt

Starship is a minimal, blazing-fast, and infinitely customizable prompt for any shell.

Project Homepage: Starship: Cross-Shell Prompt Documentation: Configuration | Starship

🚀 Installation

Prerequisites

 Install Starship

Install the latest version for your Linux system:

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

BASH

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

1
eval "$(starship init bash)"

Install the latest version for your Windows system:

Install the latest version for your system with the MSI-installers from the releases section (opens new window)

1
choco install starship

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

PowerShell

1
Invoke-Expression (&starship init powershell)

Configuration

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

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

All configuration for starship is done in this TOML file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# ~/.config/starship.toml

# Inserts a blank line between shell prompts
add_newline = true

# Change the default prompt format
format = """\
[╭╴](238)$env_var\
$all[╰─](238)$character"""

# Change the default prompt characters
[character]
success_symbol = "[󰁔 ](238)"
error_symbol = "[ ](238)"

# Shows an icon that should be included by zshrc script based on the distribution or os
[env_var.STARSHIP_DISTRO]
format = '[$env_value](bold white)'  # removed space between distro and rest for pwsh
variable = "STARSHIP_DISTRO"
disabled = false

# Shows the username
[username]
style_user = "white bold"
style_root = "black bold"
format = "[$user]($style) "
disabled = true  # disable in powershell
show_always = false

[directory]
truncation_length = 3
truncation_symbol = "…/"
home_symbol = " ~"
read_only_style = "197"
read_only = "  "
format = "at [$path]($style)[$read_only]($read_only_style) "

[git_branch]
symbol = " "
format = "on [$symbol$branch]($style) "
truncation_length = 10
truncation_symbol = "…/"
style = "bold green"

[git_status]
format = '[\($all_status$ahead_behind\)]($style) '
style = "bold green"
conflicted = "🏳"
up_to_date = " "
untracked = " "
ahead = "⇡${count}"
diverged = "⇕⇡${ahead_count}⇣${behind_count}"
behind = "⇣${count}"
stashed = " "
modified = " "
staged = '[++\($count\)](green)'
renamed = " "
deleted = " "

[custom.tztime]
command = 'date +"%a %b %d %Y %l:%M%p"'
when = "true"
format = '[\[$symbol($output)\]](cyan)'

[custom.uptime]
command = "uptime.sh"
when = "true"
format = "[$symbol($output)](green)"

[battery]
full_symbol = "  "
charging_symbol = "⚡️ "

[[battery.display]]
threshold = 10
style = "bold red"
discharging_symbol = "  "

[[battery.display]]
threshold = 30
style = "bold yellow"
discharging_symbol = "  "

[[battery.display]]
threshold = 60
discharging_symbol = "  "

[[battery.display]]
threshold = 100
style = "bold green"
discharging_symbol = "  "

[terraform]
format = "via [ terraform $version]($style) 壟 [$workspace]($style) "

[vagrant]
format = "via [ vagrant $version]($style) "

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

[helm]
format = "via [ $version](bold purple) "

[python]
symbol = " "
python_binary = "python3"

[nodejs]
format = "via [ $version](bold green) "
disabled = true

[ruby]
format = "via [ $version]($style) "

[kubernetes]
format = 'on [ $context\($namespace\)](bold purple) '
disabled = false
[kubernetes.context_aliases]
"clcreative-k8s-staging" = "cl-k8s-staging"
"clcreative-k8s-production" = "cl-k8s-prod"
This post is licensed under CC BY 4.0 by the author.