[Feature] add linter support (#982)

This commit is contained in:
Luc Sinet 2021-07-17 00:30:38 +02:00 committed by GitHub
parent fe48ed9ef9
commit 836286798e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 107 additions and 84 deletions

33
lua/core/linter.lua Normal file
View file

@ -0,0 +1,33 @@
local M = {}
M.setup = function()
if O.lint_on_save then
require("lv-utils").define_augroups {
autolint = {
{
"BufWritePost",
"<buffer>",
":silent lua require('lint').try_lint()",
},
{
"BufEnter",
"<buffer>",
":silent lua require('lint').try_lint()",
},
},
}
end
end
local status_ok, linter = pcall(require, "lint")
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