diff --git a/7.-Example-Custom-Plugins.md b/7.-Example-Custom-Plugins.md index 942aec6..e876034 100644 --- a/7.-Example-Custom-Plugins.md +++ b/7.-Example-Custom-Plugins.md @@ -3143,11 +3143,12 @@ return { ```lua return { "mfussenegger/nvim-lint", + enabled = pcode.disable_null_ls or false, event = { "BufReadPre", "BufNewFile" }, - opts = function() + opts = function(_, opts) local mason_reg = require("mason-registry") - local linters_by_ft = {} + opts.linters_by_ft = opts.linters_by_ft or {} -- add diff langue vs filetype local keymap = { @@ -3221,18 +3222,16 @@ return { if name_map[pkg.spec.name] ~= nil then pkg.spec.name = name_map[pkg.spec.name] end - linters_by_ft[ftl] = linters_by_ft[ftl] or {} - table.insert(linters_by_ft[ftl], pkg.spec.name) + opts.linters_by_ft[ftl] = opts.linters_by_ft[ftl] or {} + table.insert(opts.linters_by_ft[ftl], pkg.spec.name) end end end end end - - return linters_by_ft end, config = function(_, opts) - require("lint").linters_by_ft = opts + require("lint").linters_by_ft = opts.linters_by_ft end, } ``` \ No newline at end of file