From e5e04c96df4174ca81655e529e6da55b48e83d9e Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Tue, 27 Feb 2024 19:16:22 +0100 Subject: [PATCH] chore(nvim): simplify configuration --- nvim/lua/plugins/linting.lua | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) 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, + }, + }, }