How to use
zig fmt with any JetBrains IDE in 2023.
Add a new custom file watcher in your IDE settings and configure it to run
I'm personally using the ZigBrains extension for JetBrains Rider right now (also works in CLion, IntelliJ, etc.),
which seems to only support formatting for
.zon but not
.zig files as of version 0.8.1.
However it may be, you can add file watchers to run
zig fmt anyway.
- Open Settings -> Tools -> File Watchers
- Add a new
- Set the File Type to
- Set Scope to
- Set Program to
- Set Arguments to
- Set Working directory to
- (optional) Disable
auto-save ...in the Advanced Options tab.
This will run
zig fmt whenever you save a file.