Starship - Cross-Shell Prompt Customizer
Starship ist eine minimale, blasenschnelle und unendlich anpassbare Aufforderung für jede Shell. Geschrieben in Rust, bietet es einen modernen Ansatz, um Shell-Prompt Anpassung mit Cross-Plattform-Kompatibilität und intelligente Kontextbewusstsein. Starship zeigt relevante Informationen auf einen Blick, während außergewöhnliche Leistung und eine saubere, minimale Ästhetik erhalten.
Installation
Schnell installieren (empfohlen)
```bash
Install via shell script (Linux/macOS)
curl -sS https://starship.rs/install.sh|sh
Update Starship (same command)
curl -sS https://starship.rs/install.sh|sh ```_
Paketmanager
macOS
```bash
Homebrew
brew install starship
MacPorts
sudo port install starship ```_
Linux
```bash
Arch Linux
sudo pacman -S starship
Debian/Ubuntu (via .deb package)
curl -sS https://starship.rs/install.sh|sh
Fedora
sudo dnf install starship
Gentoo
emerge app-shells/starship
Nix
nix-env -iA nixpkgs.starship ```_
Windows
```powershell
Winget
winget install starship
Chocolatey
choco install starship
Scoop
scoop install starship ```_
Manuelle Installation
```bash
Download binary directly
wget https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz tar -xzf starship-x86_64-unknown-linux-gnu.tar.gz sudo mv starship /usr/local/bin/ ```_
Integration von Shell
Basilikum
```bash
Add to ~/.bashrc
eval "$(starship init bash)"
Reload configuration
source ~/.bashrc ```_
Zsh
```bash
Add to ~/.zshrc
eval "$(starship init zsh)"
Reload configuration
source ~/.zshrc ```_
Fische
```bash
Add to ~/.config/fish/config.fish
starship init fish|source
Reload configuration
source ~/.config/fish/config.fish ```_
Powershell
```powershell
Add to PowerShell profile
Check profile location: $PROFILE
Invoke-Expression (&starship; init powershell)
Reload profile
. $PROFILE ```_
Andere Schalen
```bash
Ion shell (~/.config/ion/initrc)
eval $(starship init ion)
Elvish (~/.elvish/rc.elv)
eval (starship init elvish)
Tcsh (~/.tcshrc)
eval starship init tcsh
Nushell
mkdir ($nu.data-dir|path join "vendor/autoload") | starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") |
Xonsh (~/.xonshrc)
execx($(starship init xonsh)) ```_
Windows Command Prompt (mit Clink)
lua
-- Create starship.lua in Clink scripts directory
load(io.popen('starship init cmd'):read("*a"))()
_
Konfiguration
Konfiguration Datei Setup
```bash
Create configuration directory
mkdir -p ~/.config
Create configuration file
touch ~/.config/starship.toml
Alternative: Use custom location
export STARSHIP_CONFIG=~/my-starship-config.toml ```_
Grundkonfiguration Struktur
```toml
~/.config/starship.toml
Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
Inserts a blank line between shell prompts
add_newline = true
Replace the '❯' symbol in the prompt with '➜'
[character] success_symbol = '➜' error_symbol = '➜'
Disable the package module, hiding it from the prompt completely
[package] disabled = true ```_
Umweltvariablen
```bash
Custom config location
export STARSHIP_CONFIG=~/.config/my-starship.toml
Custom cache directory
export STARSHIP_CACHE=~/.starship/cache
Session logging
export STARSHIP_SESSION_KEY="$(date +%s)" ```_
Kernmodule Konfiguration
Kennnummer
toml
[character]
success_symbol = '[❯](bold%20green)'
error_symbol = '[❯](bold%20red)'
vimcmd_symbol = '[❮](bold%20green)'
vimcmd_replace_one_symbol = '[❮](bold%20purple)'
vimcmd_replace_symbol = '[❮](bold%20purple)'
vimcmd_visual_symbol = '[❮](bold%20yellow)'
_
Verzeichnis Modul
```toml [directory] truncation_length = 3 truncation_symbol = '.../' home_symbol = '~' read_only = ' 🔒' style = 'bold cyan' truncate_to_repo = true format = '$path$read_only '
[directory.substitutions] 'Documents' = '📄 ' 'Downloads' = '📥 ' 'Music' = '🎵 ' 'Pictures' = '📷 ' 'Developer' = '💻 ' ```_
Gier Integration
```toml [git_branch] symbol = '🌱 ' truncation_length = 20 truncation_symbol = '...' style = 'bold purple'
[git_status] format = '([$all_status$ahead_behind] )' style = 'cyan' conflicted = '🏳' up_to_date = '✓' untracked = '🤷' ahead = '⇡$\\{count\\}' diverged = '⇕⇡$\\{ahead_count\\}⇣$\\{behind_count\\}' behind = '⇣$\\{count\\}' stashed = '📦' modified = '📝' staged = '++($count)' renamed = '👅' deleted = '🗑' ```_
Spracherkennung
```toml [nodejs] format = 'via 🤖 $version ' detect_extensions = ['js', 'mjs', 'cjs', 'ts'] detect_files = ['package.json', '.node-version'] detect_folders = ['node_modules']
[python] symbol = '🐍 ' pyenv_version_name = true format = 'via $\\{symbol\\}$\\{pyenv_prefix\\}($\\{version\\} )(($virtualenv) )' style = 'yellow bold' pyenv_prefix = 'pyenv ' python_binary = ['./venv/bin/python', 'python', 'python3', 'python2']
[rust] format = 'via ⚙️ $version' symbol = '⚙️ '
[golang] format = 'via 🏎💨 $version ' symbol = '🏎💨 ' ```_
Systeminformationen
```toml [hostname] ssh_only = false format = '$hostname ' trim_at = '.companyname.com' disabled = false
[username] style_user = 'white bold' style_root = 'black bold' format = '$user ' disabled = false show_always = true
[time] disabled = false format = '🕙[ $time ] ' time_format = '%T' utc_time_offset = '-5' time_range = '10:00:00-14:00:00' ```_
Ausführung des Befehls
```toml [cmd_duration] min_time = 2_000 format = 'underwent $duration' disabled = false show_milliseconds = false show_notifications = false min_time_to_notify = 45_000
[jobs] symbol = '+ ' number_threshold = 1 symbol_threshold = 1 format = '$symbol$number ' style = 'bold blue' ```_
Erweiterte Konfiguration
Benutzerdefinierte Befehle
```toml [custom.git_server] command = 'git config --get remote.origin.url|sed "s/.@(.):.*/\1/"' when = 'git rev-parse --is-inside-work-tree' format = 'on $output ' style = 'bold blue' shell = ['bash', '--noprofile', '--norc'] description = 'Display git server name'
[custom.docker] command = 'docker version --format "\\{\\{.Server.Version\\}\\}"' when = 'docker info' format = 'via 🐳 $output' shell = ['bash', '--noprofile', '--norc'] ```_
Bedingte Formatierung
```toml [aws] format = 'on $symbol($profile )(($region) )([$duration] )' symbol = '☁️ ' style = 'bold yellow' disabled = false
[aws.region_aliases] ap-southeast-2 = 'au' us-east-1 = 'va' us-west-2 = 'or'
[kubernetes] format = 'on ⛵ ($user on )($cluster in )$context ($namespace) ' disabled = false
[kubernetes.context_aliases]
'dev.local.cluster.k8s' = 'dev'
'./openshift-cluster/.' = 'openshift'
'gke_.*(?P
Rechtsstreit
```toml
Enable right prompt
right_format = '$all'
Configure modules for right side
[battery] full_symbol = '🔋 ' charging_symbol = '⚡️ ' discharging_symbol = '💀 ' format = '$symbol$percentage '
[[battery.display]] threshold = 10 style = 'bold red'
[[battery.display]] threshold = 30 style = 'bold yellow'
[memory_usage] disabled = false threshold = -1 symbol = '🐏 ' style = 'bold dimmed green' format = 'via $symbol $\\{ram\\}(|$\\{swap\\}) ' ```_
Themen und Presets
Themen einstellen
```bash
List available presets
starship preset --list
Apply a preset
starship preset bracketed-segments -o ~/.config/starship.toml starship preset nerd-font-symbols -o ~/.config/starship.toml starship preset no-runtime-versions -o ~/.config/starship.toml starship preset plain-text-symbols -o ~/.config/starship.toml starship preset pure-preset -o ~/.config/starship.toml ```_
Benutzerdefinierte Farbschemas
```toml
Define custom palette
[palettes.catppuccin_mocha] rosewater = "#f5e0dc" flamingo = "#f2cdcd" pink = "#f5c2e7" mauve = "#cba6f7" red = "#f38ba8" maroon = "#eba0ac" peach = "#fab387" yellow = "#f9e2af" green = "#a6e3a1" teal = "#94e2d5" sky = "#89dceb" sapphire = "#74c7ec" blue = "#89b4fa" lavender = "#b4befe" text = "#cdd6f4" subtext1 = "#bac2de" subtext0 = "#a6adc8" overlay2 = "#9399b2" overlay1 = "#7f849c" overlay0 = "#6c7086" surface2 = "#585b70" surface1 = "#45475a" surface0 = "#313244" base = "#1e1e2e" mantle = "#181825" crust = "#11111b"
Use the palette
palette = "catppuccin_mocha"
[directory] style = "blue" ```_
Minimale Konfiguration
```toml
Minimal prompt configuration
format = """ $directory\ $git_branch\ $git_status\ $character"""
[directory] style = "blue"
[character] success_symbol = "❯" error_symbol = "❯" vimcmd_symbol = "❮"
[git_branch] format = "$branch" style = "bright-black"
[git_status] format = "[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)" style = "cyan" conflicted = "" untracked = "" modified = "" staged = "" renamed = "" deleted = "" stashed = "≡" ```_
Leistungsoptimierung
Timeout Konfiguration
```toml
Global command timeout (milliseconds)
command_timeout = 500
Module-specific timeouts
[cmd_duration] min_time = 2_000
[custom.slow_command] command = 'sleep 1 && echo "done"' when = 'true' timeout = 100 # milliseconds ```_
Schwere Module deaktivieren
```toml
Disable resource-intensive modules
[package] disabled = true
[docker_context] disabled = true
[kubernetes] disabled = true
Enable only essential modules
[git_branch] disabled = false
[git_status] disabled = false
[directory] disabled = false
[character] disabled = false ```_
Async Konfiguration
```toml
Enable async rendering for better performance
[git_status] ahead = "⇡$\\{count\\}" diverged = "⇕⇡$\\{ahead_count\\}⇣$\\{behind_count\\}" behind = "⇣$\\{count\\}" ```_
Fehlerbehebung
Debug Mode
```bash
Enable debug logging
export STARSHIP_LOG=debug starship init bash
View logs
tail -f ~/.cache/starship/session_$\\{STARSHIP_SESSION_KEY\\}.log
Test configuration
starship config ```_
Konfigurationsvalidierung
```bash
Test configuration syntax
starship config
Print current configuration
starship print-config
Explain configuration
starship explain ```_
Gemeinsame Themen
```bash
Font issues - install Nerd Font
Download from: https://www.nerdfonts.com/
Install and configure terminal to use Nerd Font
Performance issues - check module timeouts
starship timings
Module not showing - check detection settings
starship module [module_name]
Reset configuration
mv ~/.config/starship.toml ~/.config/starship.toml.backup starship config ```_
Shell-Specific Issues
```bash
Bash: Ensure proper initialization
echo 'eval "$(starship init bash)"' >> ~/.bashrc
Zsh: Check for conflicts with other prompt tools
Disable oh-my-zsh themes if using starship
ZSH_THEME="" in ~/.zshrc
Fish: Ensure proper function loading
starship init fish|source
PowerShell: Check execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser ```_
Integrationsbeispiele
Gier Workflow Integration
```toml [git_branch] format = "on $symbol$branch(:$remote_branch) " symbol = "🌱 " style = "bold purple" truncation_length = 20 truncation_symbol = "..." only_attached = false always_show_remote = false ignore_branches = ["master", "main"]
[git_commit] commit_hash_length = 7 format = '($hash$tag) ' style = "green bold" only_detached = true disabled = false tag_symbol = " 🏷 " tag_disabled = false
[git_state] format = '($state( $progress_current/$progress_total)) ' style = "bright-black" cherry_pick = "🍒 PICKING" bisect = "📊 BISECTING" am = "📥 APPLYING" am_or_rebase = "📥 APPLYING" style = "90" disabled = false
[git_metrics] added_style = "bold blue" deleted_style = "bold red" only_nonzero_diffs = true format = '(+$added )(-$deleted )' disabled = false ```_
Entwicklung Umweltdetektion
```toml [python] symbol = "🐍 " pyenv_version_name = true format = 'via $\\{symbol\\}$\\{pyenv_prefix\\}($\\{version\\} )(($virtualenv) )' style = "yellow bold" pyenv_prefix = "pyenv " python_binary = ["./venv/bin/python", "python", "python3", "python2"] detect_extensions = ["py"] detect_files = [".python-version", "Pipfile", "init.py", "pyproject.toml", "requirements.txt", "setup.py", "tox.ini"] detect_folders = [] disabled = false
[nodejs] format = "via 🤖 $version " version_format = "v$\\{raw\\}" symbol = " " style = "bold green" disabled = false not_capable_style = "bold red" detect_extensions = ["js", "mjs", "cjs", "ts", "tsx"] detect_files = ["package.json", ".node-version", ".nvmrc"] detect_folders = ["node_modules"]
[docker_context] symbol = "🐳 " style = "blue bold" format = "via $symbol$context " only_with_files = true detect_extensions = [] detect_files = ["docker-compose.yml", "docker-compose.yaml", "Dockerfile"] detect_folders = [] disabled = false ```_
Integration von Cloud Platform
```toml [aws] format = 'on $symbol($profile )(($region) )([$duration] )' symbol = "☁️ " style = "bold yellow" disabled = false expiration_symbol = "X" force_display = false
[aws.region_aliases] ap-southeast-2 = "au" us-east-1 = "va" us-west-2 = "or"
[gcloud] format = 'on $symbol$account(@$domain)(($region)) ' symbol = "☁️ " style = "bold blue" disabled = false
[gcloud.region_aliases] us-central1 = "uc1" asia-northeast1 = "an1"
[azure] disabled = false format = "on $symbol($subscription) " symbol = "ﴃ " style = "blue bold" ```_
Best Practices
Konfigurationsorganisation
```toml
Organize configuration by sections
1. Global settings
add_newline = true command_timeout = 500
2. Core prompt elements
[character] success_symbol = '❯'
[directory] style = 'bold cyan'
3. Version control
[git_branch] style = 'bold purple'
4. Language detection
[python] symbol = '🐍 '
5. Cloud and containers
[aws] symbol = '☁️ '
6. Custom modules
[custom.git_server] command = 'git config --get remote.origin.url' ```_
Leistungsleitlinien
```toml
Keep command timeouts reasonable
command_timeout = 500
Disable unused modules
[package] disabled = true
Use efficient detection patterns
[nodejs] detect_files = ["package.json"] # Most specific first
Limit truncation for better performance
[directory] truncation_length = 3
[git_branch] truncation_length = 20 ```_
Sicherheitsüberlegungen
```toml
Avoid exposing sensitive information
[username] show_always = false # Don't always show username
[hostname] ssh_only = true # Only show hostname over SSH
Be careful with custom commands
[custom.safe_command] command = 'echo "safe"' # Avoid commands that could expose secrets when = 'test -f .safe' # Use safe conditions ```_
Starship stellt den modernen Standard für die schnelle Anpassung der Shell dar und bietet beispiellose Flexibilität und Leistung in allen wichtigen Shells und Betriebssystemen. Seine Rust-basierte Architektur sorgt für schnelle Startzeiten und einen zuverlässigen Betrieb, während das TOML-Konfigurationsformat eine saubere, lesbare Möglichkeit bietet, jeden Aspekt Ihrer Aufforderung anzupassen. Egal, ob Sie ein minimales Setup oder ein funktionsreiches Display mit umfassenden Systeminformationen bevorzugen, Starship passt sich an Ihren Workflow an und behält dabei eine hervorragende Leistung.