starship/starship
Presets
Starship ships pre-baked configurations under docs/public/presets/toml/. The user runs starship preset <name> to print one or starship preset <name> -o ~/.config/starship.toml to write it.
Build-time codegen
The preset registry is generated at compile time by build.rs via a shadow-rs hook. The hook walks docs/public/presets/toml/, sorts the files, and emits two functions into the shadow module:
pub fn get_preset_list<'a>() -> &'a [print::Preset] {
&[
print::Preset("bracketed-segments"),
print::Preset("catppuccin-powerline"),
print::Preset("gruvbox-rainbow"),
// ...
]
}
pub fn get_preset_content(name: &str) -> &[u8] {
match name {
"bracketed-segments" => include_bytes!(r"<absolute path>/bracketed-segments.toml"),
// ...
}
}This means adding a preset is just dropping a <name>.toml file into docs/public/presets/toml/ and rebuilding. There's no registration code to update.
Built-in presets
As of v1.25, the following presets ship:
| Preset | What it sets up |
|---|---|
bracketed-segments |
Wraps each module in [...] brackets |
catppuccin-powerline |
Catppuccin palette in a powerline style |
gruvbox-rainbow |
Gruvbox palette, every module has a different background |
jetpack |
Compact two-line "rocket" prompt |
nerd-font-symbols |
Replaces emoji symbols with Nerd Font glyphs |
no-empty-icons |
Hides language icons when no version is found |
no-nerd-font |
Falls back to plain ASCII characters |
no-runtime-versions |
Disables every toolchain version module |
pastel-powerline |
Pastel-color powerline |
plain-text-symbols |
Replaces emoji symbols with plain text |
pure-preset |
Mimics the Pure zsh prompt |
tokyo-night |
Tokyo Night palette |
The list is alphabetized at build time via paths.sort_by_key(std::fs::DirEntry::path).
CLI integration
Preset is defined in src/print.rs as a thin wrapper around a &'static str. clap::ValueEnum is implemented to delegate to the build-generated get_preset_list(), so:
starship preset --listlists every preset name.starship preset <name>prints the preset to stdout (include_bytes!-loaded).starship preset <name> -o <file>writes it to disk.
preset_command lives in src/print.rs and handles the three modes.
Schema reference in presets
Each preset starts with a "$schema" = 'https://starship.rs/config-schema.json' line so that editors that support the JSON Schema (VS Code via the Even Better TOML extension, Helix, IntelliJ, …) can autocomplete the rest of the file.
Entry points for modification
- Adding a new preset — drop a TOML file into
docs/public/presets/toml/<name>.toml, rebuild. Add a doc page underdocs/presets/if appropriate. Don't forget the"$schema"line. - Tweaking an existing preset — edit the
.tomlfile. CI does not validate preset semantics, but thecargo test preset_command_does_not_panic_on_correct_inputstest insrc/print.rsdoes verify every preset is parseable. - Changing how presets are embedded — edit
gen_presets_hookinbuild.rs.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.