Skip to content

Instantly share code, notes, and snippets.

@gabrielbidula
Last active April 25, 2024 15:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gabrielbidula/4b8f84a02dafd242b0e1cf1d682fcaac to your computer and use it in GitHub Desktop.
Save gabrielbidula/4b8f84a02dafd242b0e1cf1d682fcaac to your computer and use it in GitHub Desktop.
fake laravel pint formatter mode
#!/bin/bash
# Check if an argument was provided
if [ $# -eq 0 ]; then
echo "No file path provided."
exit 1
fi
# Use the provided argument (file path)
file="$1"
# Ensure the file exists
if [ ! -f "$file" ]; then
echo "File does not exist: $file"
exit 1
fi
# Run pint on the provided file without outputting any progress or errors
/path/to/pint --quiet "$file"
# Output the content of the file
cat "$file"
@gopeter
Copy link

gopeter commented Apr 25, 2024

You can also add this to your .zed/settings.json:

{
  "language_overrides": {
    "PHP": {
      "format_on_save": {
        "external": {
          "command": "bash",
          "arguments": ["-c", "vendor/bin/pint --quiet {buffer_path} && cat {buffer_path}"]
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment