summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/linter.lua
blob: 94dff93be48e480e2ba6e27e2d996e09c2da01ed (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("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