2021-07-17 00:30:38 +02:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.setup = function()
|
|
|
|
if O.lint_on_save then
|
|
|
|
require("lv-utils").define_augroups {
|
2021-07-20 17:20:10 +02:00
|
|
|
autolint = {
|
2021-07-17 00:30:38 +02:00
|
|
|
{
|
|
|
|
"BufWritePost",
|
|
|
|
"<buffer>",
|
|
|
|
":silent lua require('lint').try_lint()",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BufEnter",
|
|
|
|
"<buffer>",
|
|
|
|
":silent lua require('lint').try_lint()",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-19 18:12:59 +02:00
|
|
|
local status_ok, _ = pcall(require, "lint")
|
2021-07-17 00:30:38 +02:00
|
|
|
if not status_ok then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if not O.lint_on_save then
|
|
|
|
vim.cmd [[if exists('#autolint#BufWritePost')
|
|
|
|
:autocmd! autolint
|
|
|
|
endif]]
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|