15 hours ago
- Zig fmt is steerable, allowing users to control layout by choosing variations based on existing file content (e.g., trailing commas).
- The formatter adjusts function call layout: single-line with no trailing comma, or one argument per line with a trailing comma.
- A non-trivial customization is columnar array layout, where the first line break determines alignment (e.g., three items per line).
- Using array concatenation (++), you can vary the number of items per line for custom formatting (e.g., key-value pairs).
- The author recommends leaning into key choices (blank lines, intermediate variables) rather than letting the formatter guess.