linter.lua 583 B

123456789101112131415161718192021222324252627282930313233
  1. local M = {}
  2. M.setup = function()
  3. if O.lint_on_save then
  4. require("lv-utils").define_augroups {
  5. autolint = {
  6. {
  7. "BufWritePost",
  8. "<buffer>",
  9. ":silent lua require('lint').try_lint()",
  10. },
  11. {
  12. "BufEnter",
  13. "<buffer>",
  14. ":silent lua require('lint').try_lint()",
  15. },
  16. },
  17. }
  18. end
  19. end
  20. local status_ok, _ = pcall(require, "lint")
  21. if not status_ok then
  22. return
  23. end
  24. if not O.lint_on_save then
  25. vim.cmd [[if exists('#autolint#BufWritePost')
  26. :autocmd! autolint
  27. endif]]
  28. end
  29. return M