neovim-flake/modules/plugins/diagnostics/nvim-lint/config.nix

39 lines
832 B
Nix
Raw Normal View History

2025-02-01 07:31:29 +03:00
{
config,
lib,
...
}: let
2025-03-27 16:31:52 +01:00
inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
2025-02-01 07:31:29 +03:00
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.diagnostics.nvim-lint;
in {
2025-03-27 16:31:52 +01:00
config = mkMerge [
(mkIf cfg.enable {
vim = {
startPlugins = ["nvim-lint"];
pluginRC.nvim-lint = entryAnywhere ''
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
'';
};
})
(mkIf cfg.lint_after_save {
vim = {
augroups = [{name = "nvf_nvim_lint";}];
autocmds = [
{
event = ["BufWritePost"];
callback = mkLuaInline ''
function()
require("lint").try_lint()
end
'';
}
];
};
})
];
2025-02-01 07:31:29 +03:00
}