aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGovind Singh Rajpurohit <connect.govinds@gmail.com>2023-11-15 07:02:46 +0000
committerGitHub <noreply@github.com>2023-11-14 23:02:46 -0800
commitaa36bc05563d5390a2ef67956d72560048acdc2e (patch)
tree9e2c7bee34fe2877d9f969e6e77048d7897e2450
parentca3dfba94600aa62bfc88ae37cbd4f17eaea2553 (diff)
feat: add cbfmt (#198)
* feat: add cbfmt * lint: fix style --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/cbfmt.lua15
2 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index a24eb57..707483a 100644
--- a/README.md
+++ b/README.md
@@ -188,6 +188,7 @@ You can view this list in vim with `:help conform-formatters`
- [blade-formatter](https://github.com/shufo/blade-formatter) - An opinionated blade template formatter for Laravel that respects readability.
- [blue](https://github.com/grantjenks/blue) - The slightly less uncompromising Python code formatter.
- [buf](https://buf.build/docs/reference/cli/buf/format) - A new way of working with Protocol Buffers.
+- [cbfmt](https://github.com/lukas-reineke/cbfmt) - A tool to format codeblocks inside markdown and org documents.
- [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/cbfmt.lua b/lua/conform/formatters/cbfmt.lua
new file mode 100644
index 0000000..57c48e4
--- /dev/null
+++ b/lua/conform/formatters/cbfmt.lua
@@ -0,0 +1,15 @@
+local util = require("conform.util")
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/lukas-reineke/cbfmt",
+ description = "A tool to format codeblocks inside markdown and org documents.",
+ },
+ command = "cbfmt",
+ args = { "--write", "--best-effort", "$FILENAME" },
+ cwd = util.root_file({
+ -- https://github.com/lukas-reineke/cbfmt#config
+ ".cbfmt.toml",
+ }),
+ stdin = false,
+}