added conform

This commit is contained in:
2024-02-08 14:54:22 +01:00
parent 48d934c361
commit 0d028910ce
4 changed files with 31 additions and 1 deletions

22
after/plugin/conform.lua Normal file
View File

@@ -0,0 +1,22 @@
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
c = { "clang_format" },
cs = { "csharpier" },
javascript = { { "prettierd", "prettier" } },
rust = { "rustfmt" },
},
})
conform.formatters.clang_format = {
args = { "--style", "{IndentWidth: 4, UseTab: Always, TabWidth: 4}" },
}
conform.formatters.rustfmt = {
args = { "--edition", "2021" },
}
vim.keymap.set("n", "<leader>f", function()
conform.format({ bufnr = vim.lsp.bufnr })
end)