Jannik

Jannik Baranczyk

Back to home
2024-07-16

Configuring Pint as a PHP formatter in Zed

Just as Pint is an excellent formatter for PHP files, Zed is an excellent new code editor that I mostly use these days.

Since there’s no official plugin yet, it’s a bit tricky to set up Pint as the default formatter for PHP files. You can set it up by adding this snippet to .zed/settings.json:

{
  "languages": {
    "PHP": {
      "formatter": {
        "external": {
          "command": "bash",
          "arguments": [
            "-c",
            "temp=$(mktemp) && cat > $temp && ./vendor/bin/pint --quiet $temp && cat $temp"
          ]
        }
      }
    }
  }
}