From b325b7194085cc1abf0ca15287bd4c4da216f02c Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Sun, 7 Jul 2024 11:48:54 +0200 Subject: [PATCH] NVim: formatter with conform --- modules/hm/vim.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/modules/hm/vim.nix b/modules/hm/vim.nix index 151a287..ddf2b99 100644 --- a/modules/hm/vim.nix +++ b/modules/hm/vim.nix @@ -1,5 +1,6 @@ { pkgs, ... }: let vp = pkgs.vimPlugins; in { + home.packages = [ pkgs.nodePackages.prettier ]; programs.neovim = { enable = true; @@ -312,6 +313,33 @@ let vp = pkgs.vimPlugins; in { ''; } + { + plugin = vp.conform-nvim; + type = "lua"; + config = '' + require("conform").setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "fallback", + }, + }) + ''; + } + { plugin = vp.obsidian-nvim; type = "lua"; @@ -332,6 +360,9 @@ let vp = pkgs.vimPlugins; in { ''; } ]; + + + # settings = { ignorecase = true; }; # coc.enable = true; # extraConfig = ''