chore(nvim): simplify configuration

This commit is contained in:
Stefan Imhoff
2024-02-27 19:16:22 +01:00
parent edf74856f9
commit e5e04c96df

View File

@@ -6,10 +6,19 @@ return {
"BufWritePre",
"BufNewFile",
},
config = function()
local lint = require("lint")
lint.linters_by_ft = {
keys = {
{
"<leader>L",
mode = { "n" },
function()
require("lint").try_lint()
end,
desc = "Trigger linting for current file",
},
},
opts = {
events = { "BufEnter", "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
astro = { "eslint_d" },
javascript = { "eslint_d" },
javascriptreact = { "eslint_d" },
@@ -17,18 +26,6 @@ return {
svelte = { "eslint_d" },
typescript = { "eslint_d" },
typescriptreact = { "eslint_d" },
}
local lint_augrup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augrup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>L", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
},
},
}