-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlints.lua
More file actions
32 lines (29 loc) · 905 Bytes
/
lints.lua
File metadata and controls
32 lines (29 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
return {
"mfussenegger/nvim-lint",
event = "LazyFile",
opts = {
linters_by_ft = {
lua = { "selene" },
sh = { "shellcheck" },
},
},
config = function(_, opts)
local lint = require "lint"
lint.linters_by_ft = opts.linters_by_ft
local function debounce(ms, fn)
return function()
local timer = vim.uv.new_timer()
if timer then
timer:start(ms, 0, function()
timer:stop()
vim.schedule_wrap(fn)()
end)
end
end
end
vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost", "InsertLeave" }, {
group = vim.api.nvim_create_augroup("pea_lints", { clear = true }),
callback = debounce(100, lint.try_lint),
})
end,
}