Quick Reference¶
A condensed reference for Starship configuration.
Installation¶
# macOS/Linux
curl -sS https://starship.rs/install.sh | sh
# Homebrew
brew install starship
# Cargo
cargo install starship --locked
Shell Setup¶
Configuration File¶
Location: ~/.config/starship.toml
Custom location:
Style Syntax¶
style = "attribute color"
style = "fg:color bg:color"
style = "bold italic underline dimmed fg:#hex"
Colors¶
| Type | Examples |
|---|---|
| Basic | black, red, green, yellow, blue, purple, cyan, white |
| Bright | bright-red, bright-green, etc. |
| Hex | #ff5733, #2e3440 |
| 256 | 208, 39, 156 |
Attributes¶
bold, italic, underline, dimmed, inverted, blink
Format Strings¶
format = "text [$variable]($style) "
format = "[$symbol$version]($style)"
format = "(optional content)" # Shows only if variables have values
Common Modules¶
Character¶
[character]
success_symbol = "[>](bold green)"
error_symbol = "[>](bold red)"
vimcmd_symbol = "[<](bold green)"
Directory¶
[directory]
truncation_length = 3
truncate_to_repo = true
style = "bold cyan"
format = "[$path]($style)[$read_only]($read_only_style) "
Git Branch¶
[git_branch]
format = "[$symbol$branch(:$remote_branch)]($style) "
symbol = " "
style = "bold purple"
truncation_length = 30
Git Status¶
[git_status]
format = '([$all_status$ahead_behind]($style) )'
style = "bold red"
ahead = "up${count}"
behind = "dn${count}"
conflicted = "!"
untracked = "?"
modified = "*"
staged = "+"
renamed = ">"
deleted = "x"
stashed = "$"
Time¶
Command Duration¶
Language Modules¶
[nodejs]
format = "[$symbol($version )]($style)"
symbol = " "
[python]
format = '[$symbol$version(\($virtualenv\))]($style) '
symbol = " "
[rust]
format = "[$symbol($version )]($style)"
symbol = " "
[golang]
format = "[$symbol($version )]($style)"
symbol = " "
Cloud Modules¶
[aws]
format = '[$symbol($profile)(\($region\))]($style) '
symbol = " "
[kubernetes]
disabled = false
format = '[$symbol$context(:$namespace)]($style) '
symbol = " "
[docker_context]
format = '[$symbol$context]($style) '
symbol = " "
System Modules¶
[hostname]
ssh_only = true
format = "[$hostname]($style) "
[username]
show_always = false
format = "[$user]($style)@"
[battery]
disabled = false
[[battery.display]]
threshold = 20
style = "bold red"
[memory_usage]
disabled = false
threshold = 70
format = "[$ram_pct]($style) "
Custom Modules¶
[custom.name]
command = "echo output"
when = "test condition"
format = "[$symbol$output]($style) "
style = "bold green"
symbol = " "
detect_files = ["file.txt"]
Disable Modules¶
Enable Disabled-by-Default¶
Presets¶
# List presets
starship preset --list
# Apply preset (overwrites config!)
starship preset nerd-font-symbols -o ~/.config/starship.toml
# Preview preset
starship preset nerd-font-symbols
Debugging¶
# Show active modules
starship explain
# Show timings
starship timings
# Print merged config
starship print-config
# Generate bug report
starship bug-report
# Verbose logging
STARSHIP_LOG=trace starship prompt
Environment Variables¶
| Variable | Purpose |
|---|---|
STARSHIP_CONFIG | Config file path |
STARSHIP_CACHE | Cache directory |
STARSHIP_LOG | Log level (trace, debug, info) |
Common Patterns¶
Minimal Prompt¶
add_newline = false
format = "$directory$character"
[character]
success_symbol = "[>](green)"
error_symbol = "[>](red)"
[directory]
truncation_length = 1
Two-Line Prompt¶
Right Prompt¶
Developer Prompt¶
Server Prompt¶
format = """
$username@$hostname $directory$git_branch
$character"""
[username]
show_always = true
[hostname]
ssh_only = false
Nerd Font Symbols¶
| Module | Symbol |
|---|---|
| Git | |
| Node.js | |
| Python | |
| Rust | |
| Go | |
| Docker | |
| Kubernetes | |
| AWS | |
| Directory | |
| Time |
Text-Only Symbols¶
[git_branch]
symbol = "git:"
[nodejs]
symbol = "node:"
[python]
symbol = "py:"
[rust]
symbol = "rs:"
[golang]
symbol = "go:"
[docker_context]
symbol = "docker:"
[kubernetes]
symbol = "k8s:"
[aws]
symbol = "aws:"