diff --git a/nvim/lua/plugins/linting.lua b/nvim/lua/plugins/linting.lua index d760ee7..6f5b98e 100644 --- a/nvim/lua/plugins/linting.lua +++ b/nvim/lua/plugins/linting.lua @@ -6,10 +6,19 @@ return { "BufWritePre", "BufNewFile", }, - config = function() - local lint = require("lint") - - lint.linters_by_ft = { + keys = { + { + "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", "L", function() - lint.try_lint() - end, { desc = "Trigger linting for current file" }) - end, + }, + }, }