From 43cc16d73ad59beee631c25e77cc3ec493adae39 Mon Sep 17 00:00:00 2001 From: htom Date: Mon, 29 Dec 2025 15:07:35 +0100 Subject: [PATCH] updated conform formatter to work with c --- lua/kickstart/plugins/conform.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/conform.lua b/lua/kickstart/plugins/conform.lua index ca7c0c0..4e7d9bd 100644 --- a/lua/kickstart/plugins/conform.lua +++ b/lua/kickstart/plugins/conform.lua @@ -19,7 +19,7 @@ return { -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = false, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else @@ -31,12 +31,20 @@ return { end, formatters_by_ft = { lua = { 'stylua' }, + c = { 'clang-format' }, + cpp = { 'clang-format' }, -- 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 }, }, + formatters = { + ['clang-format'] = { + -- This argument forces 4-space indentation directly in the command + prepend_args = { '--style={IndentWidth: 4, TabWidth: 4, UseTab: Never, AccessModifierOffset: -4}' }, + }, + }, }, }, }