diff options
Diffstat (limited to 'after/plugin/conform.lua')
-rw-r--r-- | after/plugin/conform.lua | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua index 7a8bbce..643743f 100644 --- a/after/plugin/conform.lua +++ b/after/plugin/conform.lua @@ -12,42 +12,42 @@ conform.setup({ }, }) -conform.formatters["clang-format"] = { - prepend_args = { - "--style", - "{" - .. "IndentWidth: 4, " - .. "AlignAfterOpenBracket: BlockIndent, " - .. "AlignArrayOfStructures: Right, " - .. "BreakBeforeBraces: Linux, " - .. "PointerAlignment: Left," - .. "AllowShortIfStatementsOnASingleLine: true, " - .. "AllowShortLoopsOnASingleLine: true, " - .. "AllowAllArgumentsOnNextLine: true, " - .. "AllowShortCaseLabelsOnASingleLine: true, " - .. "BreakAfterReturnType: AllDefinitions, " - .. "ColumnLimit: " - .. vim.o.tw - .. "}", - }, -} +-- conform.formatters["clang-format"] = { +-- prepend_args = { +-- "--style", +-- "{" +-- .. "IndentWidth: 4, " +-- .. "AlignAfterOpenBracket: BlockIndent, " +-- .. "AlignArrayOfStructures: Right, " +-- .. "BreakBeforeBraces: Linux, " +-- .. "PointerAlignment: Left," +-- .. "AllowShortIfStatementsOnASingleLine: true, " +-- .. "AllowShortLoopsOnASingleLine: true, " +-- .. "AllowAllArgumentsOnNextLine: true, " +-- .. "AllowShortCaseLabelsOnASingleLine: true, " +-- .. "AlwaysBreakAfterReturnType: AllDefinitions, " +-- .. "ColumnLimit: " +-- .. vim.o.tw +-- .. "}", +-- }, +-- } --- ID of autocmd for CFormat -vim.b.CFormatID = nil --- Enable formatting on save for C only when using the :CFormat command -vim.api.nvim_create_user_command("CFormat", function() - if vim.b.CFormatID == nil then - vim.b.CFormatID = vim.api.nvim_create_autocmd("BufWritePre", { - buffer = 0, - callback = function() - conform.format({ formatters = { "clang-format" } }) - end, - }) - conform.format({ formatters = { "clang-format" } }) - print("Auto formatting enabled.") - else - vim.api.nvim_del_autocmd(vim.b.CFormatID) - print("Auto formatting disabled.") - vim.b.CFormatID = nil - end -end, {}) +-- -- ID of autocmd for CFormat +-- vim.b.CFormatID = nil +-- -- Enable formatting on save for C only when using the :CFormat command +-- vim.api.nvim_create_user_command("CFormat", function() +-- if vim.b.CFormatID == nil then +-- vim.b.CFormatID = vim.api.nvim_create_autocmd("BufWritePre", { +-- buffer = 0, +-- callback = function() +-- conform.format({ formatters = { "clang-format" } }) +-- end, +-- }) +-- conform.format({ formatters = { "clang-format" } }) +-- print("Auto formatting enabled.") +-- else +-- vim.api.nvim_del_autocmd(vim.b.CFormatID) +-- print("Auto formatting disabled.") +-- vim.b.CFormatID = nil +-- end +-- end, {}) |