Closed M-Xue closed 6 months ago
You can modify the linters_by_ft table in a keymap if you want to stop running those linters. To learn how to hide/show the results read the vim.diagnostic help page
For those need a toggle way,
return {
"mfussenegger/nvim-lint",
ft = { "python" },
dependencies = {
"williamboman/mason.nvim"
},
config = function()
require("lint").linters_by_ft = {
python = { "ruff" },
}
local lint = false
local toggle_lint = function()
if lint == true then
lint = false
vim.diagnostic.reset(nil, 0)
else
lint = true
require("lint").try_lint()
end
end
vim.keymap.set({ "n" }, "<M-l>", toggle_lint, { noremap = true, desc = "Lint"})
end,
}
Am I wrong or this will reset all of the diagnostic for that buffer, and not only the nvim-lint
one?
I want to add a spell check linter that I can toggle on and off with a keymap. Is there anyway to programatically disable and enable a linter using nvim-lint?
Maybe I could make a persistent state in my nvim config and toggle this value on and off but I need a way to disable/enable this linter based on the value of the state in my autocmd.