Code Formatter
ZetoPad includes a code formatter to keep your snippets clean and consistent.
Formatting Code
- Open a code snippet
- Press
Cmd+Shift+Fto format - Or right-click and select “Format Code”
Format on Save
Enable automatic formatting when you save:
- Open Settings > Editor
- Enable “Format on Save”
Now every Cmd+S will format and save.
Formatter Panel
Open the Formatter Panel to configure options:
- Click the formatter icon in the toolbar
- Or use Command Palette: “Toggle Formatter Panel”
Supported Languages
| Language | Formatter |
|---|---|
| JavaScript | Built-in |
| TypeScript | Built-in |
| JSON | Built-in |
| HTML | Built-in |
| CSS | Built-in |
| Markdown | Built-in |
| Python | External (if installed) |
| Rust | External (if installed) |
| Go | External (if installed) |
Configuration Options
Indentation
| Option | Values |
|---|---|
| Type | Spaces or Tabs |
| Size | 2, 4, or 8 |
Line Length
Set the preferred maximum line length for wrapping:
- 80 (traditional)
- 100 (common)
- 120 (wider screens)
Other Options
- Trailing Commas - Add commas after last item
- Semicolons - Include or omit semicolons (JS/TS)
- Quote Style - Single or double quotes
- Bracket Spacing -
{ foo }vs{foo}
JSON Formatting
For JSON snippets, formatting:
- Validates JSON syntax
- Applies consistent indentation
- Sorts keys (optional)
- Removes trailing commas
Minify JSON
Right-click and select “Minify” to compress JSON to a single line.
External Formatters
For languages not built-in, ZetoPad can use external formatters if installed:
| Language | Formatter | Install |
|---|---|---|
| Python | Black | pip install black |
| Rust | rustfmt | rustup component add rustfmt |
| Go | gofmt | Included with Go |
Configure external formatter paths in Settings if they’re not in your PATH.
Per-Language Settings
Override global settings for specific languages:
{ "formatter": { "javascript": { "tabSize": 2, "semicolons": false }, "python": { "lineLength": 88 } }}