From 8c340dff6a39623ffd014539bfda264c371010fa Mon Sep 17 00:00:00 2001 From: poslop Date: Thu, 30 Jul 2026 17:49:27 -0500 Subject: [PATCH] yaml: add blank line before top-level blocks after yamlfmt --- lua/plugins/format.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua index a5dc86f..7df0ca6 100644 --- a/lua/plugins/format.lua +++ b/lua/plugins/format.lua @@ -17,8 +17,8 @@ return { opts = { formatters_by_ft = { lua = { "stylua" }, - yml = { "yamlfmt" }, - yaml = { "yamlfmt" }, + yml = { "yamlfmt", "blank_yaml_blocks" }, + yaml = { "yamlfmt", "blank_yaml_blocks" }, nix = { "nixfmt" }, bash = { "shfmt" }, php = { "mago_format" }, @@ -31,6 +31,11 @@ return { shfmt = { append_args = { "-i", "2" }, }, + blank_yaml_blocks = { + command = "awk", + args = { "{ if (NR>1 && $0 ~ /^[A-Za-z_][A-Za-z0-9_.-]*:/) print \"\"; print }" }, + stdin = true, + }, }, }, },