mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-03 09:35:26 +02:00
[Feature] add linter support (#982)
This commit is contained in:
parent
fe48ed9ef9
commit
836286798e
15 changed files with 107 additions and 84 deletions
33
lua/core/linter.lua
Normal file
33
lua/core/linter.lua
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue