Skip to content

feat: add zsort formatter - #896

Open
mstdokumaci wants to merge 1 commit into
stevearc:masterfrom
mstdokumaci:master
Open

feat: add zsort formatter#896
mstdokumaci wants to merge 1 commit into
stevearc:masterfrom
mstdokumaci:master

Conversation

@mstdokumaci

Copy link
Copy Markdown

Adds a formatter definition for zsort, an opinionated @import organizer for Zig. It sorts, groups, and hoists import declarations into four bands (std/builtin, third-party, local, aliases), similar to isort for Python.

The formatter runs zsort fix on a temp file (stdin = false): conform copies the buffer to .conform.$RANDOM.$FILENAME, zsort rewrites it in place, and conform reads the result back.

Installation

zsort must be on $PATH:

brew tap mstdokumaci/zsort
brew install mstdokumaci/zsort/zsort

Prebuilt binaries are also available on the releases page (https://github.com/mstdokumaci/zsort/releases).

Usage

require("conform").setup({
  formatters_by_ft = {
    zig = { "zsort", "zigfmt" },
  },
})

zsort organizes imports; zigfmt handles general formatting. The two don't conflict — zig fmt never reorders imports.

@github-actions
github-actions Bot requested a review from stevearc August 16, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant