Starship
Minimal, fast, and customizable cross-shell prompt.
Official WebsiteFeatures
Installation
brew install starshippacman -S starshipcargo install starshipWhy use Starship?
Lightning fast
Written in Rust, the prompt renders extremely fast. No need to worry about startup time.
Cross-shell support
Works with Bash, Zsh, Fish, PowerShell, Ion, Elvish, and virtually all shells.
Easy customization
Intuitive customization with TOML configuration files. No complex scripts needed.
Rich information display
Git, programming language versions, cloud environments, and more info automatically displayed.
Installation
Starship can be installed with various package managers and installation scripts.
# macOS (Homebrew)
brew install starship
# Linux (curl)
curl -sS https://starship.rs/install.sh | sh
# Cargo (Rust)
cargo install starship --locked
# Windows (Scoop)
scoop install starship
# Windows (winget)
winget install --id Starship.StarshipShell Configuration
After installation, add the following to your shell configuration file.
Zsh (~/.zshrc)
# Initialize Starship
eval "$(starship init zsh)"Bash (~/.bashrc)
# Initialize Starship
eval "$(starship init bash)"Fish (~/.config/fish/config.fish)
# Initialize Starship
starship init fish | sourcePowerShell
# Add to profile ($PROFILE)
Invoke-Expression (&starship init powershell)Customization
Create the configuration file at ~/.config/starship.toml.
Basic configuration example
# Configure the whole prompt
format = """
$username$hostname$directory$git_branch$git_status$cmd_duration$line_break$character"""
# Show command execution time (if it takes more than 2 seconds)
[cmd_duration]
min_time = 2_000
format = "took [$duration]($style) "
style = "yellow bold"
# Directory display
[directory]
truncation_length = 3
truncate_to_repo = true
style = "cyan bold"
# Git branch display
[git_branch]
symbol = " "
format = "on [$symbol$branch]($style) "
style = "purple bold"
# Git status
[git_status]
format = '([[$all_status$ahead_behind]]($style) )'
style = "red bold"
# Prompt character
[character]
success_symbol = "[❯](green bold)"
error_symbol = "[❯](red bold)"Programming language version display
# Node.js
[nodejs]
format = "via [$symbol($version )]($style)"
symbol = " "
# Python
[python]
format = 'via [$symbol$pyenv_prefix($version )(($virtualenv) )]($style)'
symbol = " "
# Rust
[rust]
format = "via [$symbol($version )]($style)"
symbol = " "
# Go
[golang]
format = "via [$symbol($version )]($style)"
symbol = " "Prompt examples
Examples of how Starship prompts are displayed.
Git status symbol meanings
?Untracked files!Modified+Staged~Renamed-Deleted⇡Waiting to push⇣Waiting to pull⇕DivergedTips
Use presets
With official presets, you can quickly start using a beautiful-looking prompt.
# View available presets
starship preset --list
# Apply Nerd Font Symbols preset
starship preset nerd-font-symbols -o ~/.config/starship.toml
# Apply Tokyo Night preset
starship preset tokyo-night -o ~/.config/starship.tomlDisplay configuration information
You can check the current settings and default configuration.
# Display current configuration
starship config
# Output default configuration for all modules
starship print-config --defaultDisable specific modules
You can disable unwanted information by setting disabled = true.
# Disable AWS display
[aws]
disabled = true
# Disable package version
[package]
disabled = trueInstall Nerd Font
To display icons correctly, you need to install a Nerd Font and use it in your terminal. Recommended fonts include JetBrainsMono Nerd Font, FiraCode Nerd Font, and Hack Nerd Font. You can download them from the Nerd Fonts official website.