From 14ee4f6f0b753b3dbde1ccc5de773ff3301938ea Mon Sep 17 00:00:00 2001 From: gered Date: Fri, 6 Sep 2024 18:46:22 -0400 Subject: [PATCH] add formatter config for yamlfix and clang-format clang-format's built in styles REALLY all suck quite badly. how the fuck is it possible that this tool can be made with builtin styles that offer very little in the way of variety? jesus christ ... --- lua/plugins/conform.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 6357da0..cdb8ae4 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -35,11 +35,20 @@ return { end, formatters_by_ft = { lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + yaml = { 'yamlfmt' }, + c = { 'clang-format' }, + }, + formatters = { + ['yamlfmt'] = { + prepend_args = { '-formatter', 'retain_line_breaks_single=true,trim_trailing_whitespace=true' }, + }, + -- all of the builtin clang-format styles are pretty bad IMHO. don't fallback to any. + -- unfortunately, `--fallback-style` doesn't allow inline customization like the + -- `--style` option does. + -- i really can't say that i'm impressed with clang-format overall ... + ['clang-format'] = { + prepend_args = { '--style=file', '--fallback-style=none' }, + }, }, }, },