summaryrefslogtreecommitdiff
path: root/lua/core/linter.lua
blob: 676b0cf7daadd09d9c32793ee76c9cf22cd2f3e4 (plain)
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
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, _ = 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