nvim-lint: moved linting into its own global function "nvf_lint(buf)"

This commit is contained in:
rice-cracker-dev 2025-04-14 00:02:54 +07:00
commit acbeb26854

View file

@ -28,18 +28,9 @@ in {
end
end
end
'';
};
})
(mkIf (cfg.enable && cfg.lint_after_save) {
vim = {
augroups = [{name = "nvf_nvim_lint";}];
autocmds = [
{
event = ["BufWritePost"];
callback = mkLuaInline ''
function(args)
local ft = vim.api.nvim_get_option_value("filetype", { buf = args.buf })
function nvf_lint(buf)
local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
local linters = require("lint").linters
local linters_from_ft = require("lint").linters_by_ft[ft]
@ -73,6 +64,19 @@ in {
end
end
'';
};
})
(mkIf (cfg.enable && cfg.lint_after_save) {
vim = {
augroups = [{name = "nvf_nvim_lint";}];
autocmds = [
{
event = ["BufWritePost"];
callback = mkLuaInline ''
function(args)
nvf_lint(args.buf)
end
'';
}
];
};