Skip to content

Commit 43f7f92

Browse files
jdeveraclaude
andcommitted
Starship: Refactor to layered config with separate preset file
Store nerd-font-symbols preset as a separate file downloaded from starship.rs, merged with custom settings at apply time. This prevents symbol corruption if tools mangle the template. Architecture: - nerd-font-symbols.toml: upstream preset (static, in repo) - starship.yml: customizations (palettes, character symbols, modules) - starship.toml.tmpl: merges layers via chezmoi template functions Also adds tools/starship-diff to compare config against upstream preset and detect when new symbols are available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8c12bd2 commit 43f7f92

File tree

7 files changed

+689
-365
lines changed

7 files changed

+689
-365
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ Two flavors generated from one template:
6262

6363
The shell auto-detects and switches configs.
6464

65+
**Layered config architecture:**
66+
67+
```
68+
nerd-font-symbols.toml (preset from starship.rs, stored in repo)
69+
↓ merge
70+
starship.yml (custom: palettes, character symbols, modules)
71+
↓ merge
72+
starship.toml (final output)
73+
```
74+
75+
Nerd Font symbols live in a separate file so they won't get corrupted
76+
if tools mangle the template. Customizations are in YAML, merged at apply time.
77+
78+
**Checking for preset updates:**
79+
80+
```sh
81+
./tools/starship-diff
82+
```
83+
84+
Compares your config against the upstream nerd-font-symbols preset.
85+
Shows new symbols you might want to add.
86+
6587
---
6688

6789
## 📝 Editors

home/.chezmoidata/starship.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Starship configuration data
2+
# This file contains custom settings that are merged with the nerd-font-symbols preset
3+
# See: home/.chezmoitemplates/starship.toml.tmpl for the merge logic
4+
5+
starship:
6+
# Top-level settings
7+
palette: "catppuccin_macchiato"
8+
9+
# Custom module settings (merged into base preset modules)
10+
custom_modules:
11+
directory:
12+
truncation_symbol: "…/"
13+
truncation_length: 4
14+
style: "bold lavender"
15+
git_branch:
16+
style: "bold mauve"
17+
18+
# Custom modules (added to config)
19+
custom:
20+
window_title:
21+
description: "Set window title to current directory (fixes title not resetting after git diff, less, etc.)"
22+
when: true
23+
command: 'printf "\\033]2;%s\\007" "$(starship module directory 2>/dev/null | sed "s/\\x1b\\[[0-9;]*m//g" | tr -d "\\n")"'
24+
format: "$output"
25+
shell: ["sh"]
26+
chezmoi:
27+
disabled: false
28+
when: 'test -n "$CHEZMOI_EXECUTABLE"'
29+
symbol: "𖠿 chezmoi "
30+
description: "In a 'chezmoi cd' shell"
31+
32+
# Character module settings for unicode variant
33+
character:
34+
unicode:
35+
success_symbol: "[[󰋑](green) ❯](peach)"
36+
error_symbol: "[[󰋔](red) ❯](peach)"
37+
vimcmd_symbol: "[ ❮](subtext1)"
38+
ascii:
39+
success_symbol: "[[>](bold peach)](bold)"
40+
error_symbol: "[[>](bold peach)](bold)"
41+
vimcmd_symbol: "[[<](bold subtext1)](bold)"
42+
43+
# ASCII-only custom modules (for exit code display on ASCII variant)
44+
ascii_custom:
45+
exit_ok:
46+
when: 'test -n "$__STARSHIP_EXIT_OK"'
47+
format: '[\[ 0\]](bold green) '
48+
description: "Show [ 0] on successful command"
49+
exit_err:
50+
when: 'test -n "$__STARSHIP_EXIT_FMT"'
51+
command: 'echo "$__STARSHIP_EXIT_FMT"'
52+
format: '[$output](bold red) '
53+
description: "Show padded exit code on error"
54+
55+
# Note: ASCII format string is kept in the template (starship.toml.tmpl)
56+
# because TOML multi-line strings with backslash continuations don't
57+
# translate well through YAML.
58+
59+
# Catppuccin palette definitions
60+
palettes:
61+
catppuccin_latte:
62+
rosewater: "#dc8a78"
63+
flamingo: "#dd7878"
64+
pink: "#ea76cb"
65+
mauve: "#8839ef"
66+
red: "#d20f39"
67+
maroon: "#e64553"
68+
peach: "#fe640b"
69+
yellow: "#df8e1d"
70+
green: "#40a02b"
71+
teal: "#179299"
72+
sky: "#04a5e5"
73+
sapphire: "#209fb5"
74+
blue: "#1e66f5"
75+
lavender: "#7287fd"
76+
text: "#4c4f69"
77+
subtext1: "#5c5f77"
78+
subtext0: "#6c6f85"
79+
overlay2: "#7c7f93"
80+
overlay1: "#8c8fa1"
81+
overlay0: "#9ca0b0"
82+
surface2: "#acb0be"
83+
surface1: "#bcc0cc"
84+
surface0: "#ccd0da"
85+
base: "#eff1f5"
86+
mantle: "#e6e9ef"
87+
crust: "#dce0e8"
88+
89+
catppuccin_frappe:
90+
rosewater: "#f2d5cf"
91+
flamingo: "#eebebe"
92+
pink: "#f4b8e4"
93+
mauve: "#ca9ee6"
94+
red: "#e78284"
95+
maroon: "#ea999c"
96+
peach: "#ef9f76"
97+
yellow: "#e5c890"
98+
green: "#a6d189"
99+
teal: "#81c8be"
100+
sky: "#99d1db"
101+
sapphire: "#85c1dc"
102+
blue: "#8caaee"
103+
lavender: "#babbf1"
104+
text: "#c6d0f5"
105+
subtext1: "#b5bfe2"
106+
subtext0: "#a5adce"
107+
overlay2: "#949cbb"
108+
overlay1: "#838ba7"
109+
overlay0: "#737994"
110+
surface2: "#626880"
111+
surface1: "#51576d"
112+
surface0: "#414559"
113+
base: "#303446"
114+
mantle: "#292c3c"
115+
crust: "#232634"
116+
117+
catppuccin_macchiato:
118+
rosewater: "#f4dbd6"
119+
flamingo: "#f0c6c6"
120+
pink: "#f5bde6"
121+
mauve: "#c6a0f6"
122+
red: "#ed8796"
123+
maroon: "#ee99a0"
124+
peach: "#f5a97f"
125+
yellow: "#eed49f"
126+
green: "#a6da95"
127+
teal: "#8bd5ca"
128+
sky: "#91d7e3"
129+
sapphire: "#7dc4e4"
130+
blue: "#8aadf4"
131+
lavender: "#b7bdf8"
132+
text: "#cad3f5"
133+
subtext1: "#b8c0e0"
134+
subtext0: "#a5adcb"
135+
overlay2: "#939ab7"
136+
overlay1: "#8087a2"
137+
overlay0: "#6e738d"
138+
surface2: "#5b6078"
139+
surface1: "#494d64"
140+
surface0: "#363a4f"
141+
base: "#24273a"
142+
mantle: "#1e2030"
143+
crust: "#181926"
144+
145+
catppuccin_mocha:
146+
rosewater: "#f5e0dc"
147+
flamingo: "#f2cdcd"
148+
pink: "#f5c2e7"
149+
mauve: "#cba6f7"
150+
red: "#f38ba8"
151+
maroon: "#eba0ac"
152+
peach: "#fab387"
153+
yellow: "#f9e2af"
154+
green: "#a6e3a1"
155+
teal: "#94e2d5"
156+
sky: "#89dceb"
157+
sapphire: "#74c7ec"
158+
blue: "#89b4fa"
159+
lavender: "#b4befe"
160+
text: "#cdd6f4"
161+
subtext1: "#bac2de"
162+
subtext0: "#a6adc8"
163+
overlay2: "#9399b2"
164+
overlay1: "#7f849c"
165+
overlay0: "#6c7086"
166+
surface2: "#585b70"
167+
surface1: "#45475a"
168+
surface0: "#313244"
169+
base: "#1e1e2e"
170+
mantle: "#181825"
171+
crust: "#11111b"

0 commit comments

Comments
 (0)