# Starship Configuration > [!warning] Raw notes > These are living, personal config notes — raw, frequently out-of-date, and sometimes half-baked. They reflect my setup at some point in time, not a maintained tutorial. Verify against upstream docs before copying. Reach out if something looks broken. Starship is a cross-shell prompt written in Rust. Config at `~/.config/starship.toml`. > [!note] Currently inactive > Starship is installed but not hooked into Zsh on this machine — `eval "$(starship init zsh)"` is commented out in [[Zsh Configuration|base.zsh]] because it costs ~250ms per left prompt + ~250ms per right prompt. The plain built-in prompt is active instead. The config below is kept for reference and easy re-activation. ## Prompt Format ```toml format = """ $directory\ $git_branch\ $git_status\ $git_metrics\ $golang\ $python\ $rust\ $zig\ $docker_context\ $kubernetes\ $cmd_duration\ $env_var\ $line_break\ $character""" ``` Two lines: everything on the first, the `$character` (the `➜` arrow) on the second. `$line_break` separates them. `\` at the end of each module line suppresses the trailing newline so everything stays on one line until the explicit break. ## Module Settings ### Directory ```toml [directory] truncation_length = 3 truncate_to_repo = true ``` Truncates the path to 3 components. `truncate_to_repo = true` truncates relative to the repo root rather than `$HOME`, so inside a git repo you see the repo-relative path, not the absolute one. Cuts noise in deeply nested monorepos. ### Git ```toml [git_branch] format = "[$symbol$branch]($style) " symbol = " " # nerd font branch icon [git_status] format = '([\[$all_status$ahead_behind\]]($style) )' [git_metrics] disabled = false format = "([+$added]($added_style) )([-$deleted]($deleted_style) )" ``` - `git_branch` — shows the current branch with a nerd font icon - `git_status` — shows `[✘⇡2]` style indicators for dirty state and ahead/behind counts. Wrapped in `()` so it disappears when clean - `git_metrics` — shows `+N -M` line change counts. Disabled by default in Starship; enabled here. Useful for keeping an eye on how large an in-progress change is getting ### Language Modules Each language module only activates when the relevant project files are detected: ```toml [golang] format = "[$symbol($version)]($style) " detect_files = ["go.mod", "go.sum"] [python] format = "[$symbol($version)]($style) " detect_files = ["pyproject.toml", "requirements.txt", "setup.py"] [rust] format = "[$symbol($version)]($style) " detect_files = ["Cargo.toml"] [zig] format = "[$symbol($version)]($style) " detect_files = ["build.zig"] ``` All use the same format pattern: symbol + version. `detect_files` keeps the module from showing up in directories that aren't using that language — Starship checks for the files without spawning a subprocess, so it's cheap. ### Infrastructure Modules ```toml [docker_context] format = "[$symbol$context]($style) " detect_files = ["docker-compose.yml", "docker-compose.yaml", "Dockerfile"] [kubernetes] disabled = false format = "[$symbol$context( \\($namespace\\))]($style) " symbol = "☸ " style = "blue" ``` Kubernetes is disabled by default in Starship (it calls `kubectl config current-context` which is slow on some setups). Enabled here because the k8s context is relevant day-to-day. Shows context + namespace in blue. ### Performance Modules ```toml [cmd_duration] min_time = 2000 format = "[$duration]($style) " ``` Only shows command duration when a command took more than 2 seconds. Eliminates noise from fast commands while keeping the signal for anything slow. ### Startup Time Indicator ```toml [env_var.ZSH_STARTUP_MS] format = "[⚡ ${env_value}]($style) " style = "dimmed yellow" ``` `ZSH_STARTUP_MS` is set by the perf timing harness in `~/.config/zsh/lib/perf.zsh`. When non-empty, Starship shows it in the prompt in dimmed yellow — a visible reminder if shell startup time creeps up. ### Character (Prompt Symbol) ```toml [character] success_symbol = "[➜](bold green)" error_symbol = "[➜](bold red)" ``` Classic `➜` arrow: green on success, red on failure. Minimal — no custom shapes or extra state. ## Re-activating Starship To switch from the built-in prompt back to Starship, add to `~/.zshrc.local` or `~/.config/zsh/layer.zsh`: ```zsh eval "$(starship init zsh)" ``` That overrides `PROMPT` set in `base.zsh`. The `ZSH_STARTUP_MS` env var trick still works because `perf.zsh` exports it before the prompt is initialized. ## Links - [Starship docs](https://starship.rs/config/) — full module reference - [Starship presets](https://starship.rs/presets/) — community-contributed configs - [Nerd Fonts](https://www.nerdfonts.com/) — required for `symbol = " "` and similar icons