mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-04 04:35:29 +00:00
chore(nvim): simplify configuration
This commit is contained in:
@@ -6,10 +6,19 @@ return {
|
|||||||
"BufWritePre",
|
"BufWritePre",
|
||||||
"BufNewFile",
|
"BufNewFile",
|
||||||
},
|
},
|
||||||
config = function()
|
keys = {
|
||||||
local lint = require("lint")
|
{
|
||||||
|
"<leader>L",
|
||||||
lint.linters_by_ft = {
|
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" },
|
astro = { "eslint_d" },
|
||||||
javascript = { "eslint_d" },
|
javascript = { "eslint_d" },
|
||||||
javascriptreact = { "eslint_d" },
|
javascriptreact = { "eslint_d" },
|
||||||
@@ -17,18 +26,6 @@ return {
|
|||||||
svelte = { "eslint_d" },
|
svelte = { "eslint_d" },
|
||||||
typescript = { "eslint_d" },
|
typescript = { "eslint_d" },
|
||||||
typescriptreact = { "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,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user