aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/buf.lua11
2 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1ff41b8..d6a53fe 100644
--- a/README.md
+++ b/README.md
@@ -160,6 +160,7 @@ To view configured and available formatters, as well as to see the path to the l
- [autopep8](https://github.com/hhatto/autopep8) - A tool that automatically formats Python code to conform to the PEP 8 style guide.
- [beautysh](https://github.com/lovesegfault/beautysh) - A Bash beautifier for the masses.
- [black](https://github.com/psf/black) - The uncompromising Python code formatter.
+- [buf](https://github.com/bufbuild/buf) - A new way of working with Protocol Buffers.
- [clang_format](https://www.kernel.org/doc/html/latest/process/clang-format.html) - Tool to format C/C++/… code according to a set of rules and heuristics.
- [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code.
- [cmake_format](https://github.com/cheshirekow/cmake_format) - Parse cmake listfiles and format them nicely.
diff --git a/lua/conform/formatters/buf.lua b/lua/conform/formatters/buf.lua
new file mode 100644
index 0000000..bb64c26
--- /dev/null
+++ b/lua/conform/formatters/buf.lua
@@ -0,0 +1,11 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://buf.build/docs/lint/overview",
+ description = "A new way of working with Protocol Buffers",
+ },
+ command = "buf",
+ args = { "format", "-w", "$FILENAME" },
+ stdin = false,
+ cwd = require("conform.util").root_file({ "buf.yaml" }),
+}