π§© Adding glyphs
How glyphs.json is structured and how to regenerate the bindings after editing it.
glyphs.json is the only file edited by hand. Everything else is generated from it.
Format
Each key is a kebab-case name mapping to its variants:
"check": { "nerd": "F00C", "emoji": "β" },
"bullet": { "nerd": "2022", "unicode": "203A", "emoji": "β’" }nerdandunicodeare codepoints as hex strings, a single scalar each. Storing hex means the output is escaped by construction.emojiis a literal string and may be a grapheme cluster.β οΈis U+26A0 followed by U+FE0F, stored as written and escaped only on output.nerdis expected on every glyph.unicodeandemojiare optional.
Regenerate
npm run generateThis rewrites:
src/generated.ts, the typedglyphsrecord.glyphs.plugin.zsh, the default plugin entrypoint.zsh/nerd.zsh,zsh/emoji.zshandzsh/unicode.zsh.
Each carries a "do not edit by hand" banner. Commit the regenerated files alongside the glyphs.json change.
Naming
Kebab-case in the JSON becomes camelCase in TypeScript and upper snake case in zsh:
glyphs.json | TypeScript | zsh |
|---|---|---|
arrow-down | arrowDown | ICON_ARROW_DOWN |
key-command | keyCommand | ICON_KEY_COMMAND |
Development
npm install
npm run generate
npm run typecheck
npm test
npm run build # generate, then tsup into dist