NVim: formatter with conform

This commit is contained in:
Filippo Berto 2024-07-07 11:48:54 +02:00
parent 9cebf5192d
commit b325b71940
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
let vp = pkgs.vimPlugins; in { let vp = pkgs.vimPlugins; in {
home.packages = [ pkgs.nodePackages.prettier ];
programs.neovim = { programs.neovim = {
enable = true; 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; plugin = vp.obsidian-nvim;
type = "lua"; type = "lua";
@ -332,6 +360,9 @@ let vp = pkgs.vimPlugins; in {
''; '';
} }
]; ];
# settings = { ignorecase = true; }; # settings = { ignorecase = true; };
# coc.enable = true; # coc.enable = true;
# extraConfig = '' # extraConfig = ''