From 535e2391fe280ef9633577951e83a3c08c1d4e3a Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 2 Jan 2025 11:52:13 +0100 Subject: [PATCH] feat(neovim): add code formatter plugin --- modules/home-manager/cli/neovim/default.nix | 5 +++++ modules/home-manager/cli/neovim/files/conform.lua | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 modules/home-manager/cli/neovim/files/conform.lua diff --git a/modules/home-manager/cli/neovim/default.nix b/modules/home-manager/cli/neovim/default.nix index d8c67ca..f6556e9 100644 --- a/modules/home-manager/cli/neovim/default.nix +++ b/modules/home-manager/cli/neovim/default.nix @@ -80,6 +80,11 @@ in cmp-path cmp-cmdline cmp_luasnip + { + plugin = conform-nvim; + type = "lua"; + config = (builtins.readFile ./files/conform.lua); + } { plugin = fzf-lua; type = "lua"; diff --git a/modules/home-manager/cli/neovim/files/conform.lua b/modules/home-manager/cli/neovim/files/conform.lua new file mode 100644 index 0000000..ff3d6d8 --- /dev/null +++ b/modules/home-manager/cli/neovim/files/conform.lua @@ -0,0 +1,11 @@ +require("conform").setup({ + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "never", + }, + formatters_by_ft = { + yaml = {"yamlfmt"}, + ["_"] = { "trim_whitespace" }, + } +})