diff --git a/after/ftplugin/cs.lua b/after/ftplugin/cs.lua index 2f17e97..23adbbc 100644 --- a/after/ftplugin/cs.lua +++ b/after/ftplugin/cs.lua @@ -1,3 +1,7 @@ vim.opt_local.expandtab = true vim.opt_local.shiftwidth = 4 vim.opt_local.tabstop = 4 + +vim.keymap.set("n", "f", function() + require("conform").format({ async = true }) +end, { buffer = true }) diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua new file mode 100644 index 0000000..dfae7ea --- /dev/null +++ b/lua/plugins/formatting.lua @@ -0,0 +1,19 @@ +return { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + cs = { "csharpier" }, + }, + formatters = { + csharpier = { + command = "csharpier", + args = { "format", "--stdin-path", "$FILENAME" }, + stdin = true, + }, + }, + format_on_save = { + timeout_ms = 3000, + lsp_fallback = true, + }, + }, +}