yaml: use yamlfmt retain_line_breaks instead of custom awk chain

This commit is contained in:
2026-07-30 18:03:00 -05:00
parent 9845d7f8bd
commit 61d14e52e7
+4 -6
View File
@@ -17,8 +17,8 @@ return {
opts = { opts = {
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
yml = { "yamlfmt", "blank_yaml_blocks" }, yml = { "yamlfmt" },
yaml = { "yamlfmt", "blank_yaml_blocks" }, yaml = { "yamlfmt" },
nix = { "nixfmt" }, nix = { "nixfmt" },
bash = { "shfmt" }, bash = { "shfmt" },
php = { "mago_format" }, php = { "mago_format" },
@@ -31,10 +31,8 @@ return {
shfmt = { shfmt = {
append_args = { "-i", "2" }, append_args = { "-i", "2" },
}, },
blank_yaml_blocks = { yamlfmt = {
command = "awk", args = { "-formatter", "retain_line_breaks=true", "-" },
args = { "{ if (NR>1 && $0 ~ /^[A-Za-z_][A-Za-z0-9_.-]*:/ && prev != \"\") print \"\"; print; prev = $0 }" },
stdin = true,
}, },
}, },
}, },