https://github.com/droyo/acme-autoformat
Automatically run a formatter when saving an Acme window
https://github.com/droyo/acme-autoformat
Last synced: 5 months ago
JSON representation
Automatically run a formatter when saving an Acme window
- Host: GitHub
- URL: https://github.com/droyo/acme-autoformat
- Owner: droyo
- Created: 2021-08-05T23:15:36.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-17T15:05:15.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T06:36:00.640Z (about 2 years ago)
- Language: Go
- Size: 4.88 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
acme-autoformat runs a code formatter whenever Put is executed on a matching
Acme window.
INSTALL
go get github.com/droyo/acme-autoformat
RUN
From within acme, run
acme-autoformat [-r pattern] -- command ...
Within command, the template language from Go's text/template library can
be used to populate arguments based on the `param` type in main.go. Notably,
The string '{{.Basename}}' will be replaced with the name of the file. For example,
to run `ocamlformat` on all OCaml (.ml, .mli) files, execute
acme-autoformat -r '\.mli?$' -- ocamlformat --name='{{.Basename}}' --enable-outside-detected-project -
The formatter command must accept the content of the file to format on standard
input, and write the formatted content to standard output. If the formatter fails, any
errors are written to an +Errors window sharing the same prefix as the file.
acme-autoformat expects the command `diff` to exist in its PATH, and to accept the
`-u` flag to generate a unified diff.