Compare commits

...

2 commits

Author SHA1 Message Date
rice-cracker-dev
a3051d49aa format: formatted the project 2025-04-14 00:03:22 +07:00
rice-cracker-dev
acbeb26854 nvim-lint: moved linting into its own global function "nvf_lint(buf)" 2025-04-14 00:02:54 +07:00
2 changed files with 39 additions and 33 deletions

View file

@ -28,18 +28,9 @@ in {
end end
end end
end end
'';
}; function nvf_lint(buf)
}) local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
(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 })
local linters = require("lint").linters local linters = require("lint").linters
local linters_from_ft = require("lint").linters_by_ft[ft] local linters_from_ft = require("lint").linters_by_ft[ft]
@ -73,6 +64,19 @@ in {
end end
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
'';
} }
]; ];
}; };

View file

@ -98,7 +98,9 @@ builtins.mapAttrs
Channel = getZip; Channel = getZip;
Tarball = getUrl; Tarball = getUrl;
} }
.${spec.type} .${
spec.type
}
or (builtins.throw "Unknown source type ${spec.type}"); or (builtins.throw "Unknown source type ${spec.type}");
in in
spec // {outPath = mayOverride (func spec);} spec // {outPath = mayOverride (func spec);}