lint.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. return {
  2. { -- Linting
  3. 'mfussenegger/nvim-lint',
  4. event = { 'BufReadPre', 'BufNewFile' },
  5. config = function()
  6. local lint = require 'lint'
  7. lint.linters_by_ft = {
  8. markdown = { 'markdownlint' },
  9. }
  10. -- To allow other plugins to add linters to require('lint').linters_by_ft,
  11. -- instead set linters_by_ft like this:
  12. -- lint.linters_by_ft = lint.linters_by_ft or {}
  13. -- lint.linters_by_ft['markdown'] = { 'markdownlint' }
  14. --
  15. -- However, note that this will enable a set of default linters,
  16. -- which will cause errors unless these tools are available:
  17. -- {
  18. -- clojure = { "clj-kondo" },
  19. -- dockerfile = { "hadolint" },
  20. -- inko = { "inko" },
  21. -- janet = { "janet" },
  22. -- json = { "jsonlint" },
  23. -- markdown = { "vale" },
  24. -- rst = { "vale" },
  25. -- ruby = { "ruby" },
  26. -- terraform = { "tflint" },
  27. -- text = { "vale" }
  28. -- }
  29. --
  30. -- You can disable the default linters by setting their filetypes to nil:
  31. -- lint.linters_by_ft['clojure'] = nil
  32. -- lint.linters_by_ft['dockerfile'] = nil
  33. -- lint.linters_by_ft['inko'] = nil
  34. -- lint.linters_by_ft['janet'] = nil
  35. -- lint.linters_by_ft['json'] = nil
  36. -- lint.linters_by_ft['markdown'] = nil
  37. -- lint.linters_by_ft['rst'] = nil
  38. -- lint.linters_by_ft['ruby'] = nil
  39. -- lint.linters_by_ft['terraform'] = nil
  40. -- lint.linters_by_ft['text'] = nil
  41. -- Create autocommand which carries out the actual linting
  42. -- on the specified events.
  43. local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
  44. vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
  45. group = lint_augroup,
  46. callback = function()
  47. require('lint').try_lint()
  48. end,
  49. })
  50. end,
  51. },
  52. }