config/modules/neovim/formatter.nix
chloe caruso ff5e23efc2 feat: "autofmt" code formatter
different codebases use different formatters. autofmt looks for project
configuration to pick the correct formatter, allowing an editor to
simply point to the script and have all ambiguities resolved.

this commit overhauls the conform configuration to set up autofmt
correctly, as well installing it with 'pkgs.autofmt'

closes #6
2025-08-17 20:43:47 -07:00

34 lines
783 B
Nix

{ lib, pkgs, ... }:
{
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft =
let
autofmt = lib.mkLuaInline ''{"autofmt",stop_after_first=true}'';
in
{
css = autofmt;
html = autofmt;
javascript = autofmt;
javascriptreact = autofmt;
json = autofmt;
jsonc = autofmt;
markdown = autofmt;
nix = autofmt;
rust = autofmt;
typescript = autofmt;
typescriptreact = autofmt;
yaml = autofmt;
};
formatters.autofmt = {
"inherit" = false;
args = [
"--stdio"
"$FILENAME"
];
command = "${pkgs.autofmt}/bin/autofmt";
};
};
};
}