nixos/pkgs/nixvim/lang/toml.nix

34 lines
813 B
Nix
Raw Normal View History

{
lib,
pkgs,
...
2025-07-13 06:04:55 +08:00
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.toml = {
__unkeyed-1 = "taplo";
lsp_format = "fallback";
};
formatters.taplo = {
__raw =
#lua
''
function()
local defaultFormatter = require("conform.formatters.taplo")
return vim.tbl_extend("force", defaultFormatter, {
command = function()
local exe = vim.fn["exepath"]("taplo")
if exe ~= "" then
return exe
else
return "${lib.getExe pkgs.taplo}"
end
end,
args = { "format", "-o", "reorder_keys=true", "-o", "reorder_inline_tables=true", "-" },
})
end
'';
};
};
}