summaryrefslogtreecommitdiff
path: root/lua/plugins/linter.lua
diff options
context:
space:
mode:
authorbrustybee <bee@4d2.org>2026-03-09 17:02:03 +0530
committerbrustybee <bee@4d2.org>2026-03-09 17:02:03 +0530
commit972e5f9c68cc433c5fc26adf92cd25b293a3776a (patch)
treec5930854787316181d07854048d9627538017ceb /lua/plugins/linter.lua
One shot upload
Diffstat (limited to 'lua/plugins/linter.lua')
-rw-r--r--lua/plugins/linter.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/lua/plugins/linter.lua b/lua/plugins/linter.lua
new file mode 100644
index 0000000..c804d1c
--- /dev/null
+++ b/lua/plugins/linter.lua
@@ -0,0 +1,40 @@
+return {
+ {
+ "nvim-lint",
+ event = { "BufReadPre", "BufNewFile" },
+ for_cats = "core.general",
+ after = function()
+ local lint = require("lint")
+
+ lint.linters_by_ft = {
+ python = { "ruff" },
+ go = { "golangcilint" },
+ rust = { "clippy" },
+ c = { "clangtidy" },
+ cpp = { "clangtidy" },
+ java = { "checkstyle" },
+ cmake = { "cmakelint" },
+ javascript = { "eslint_d" },
+ typescript = { "eslint_d" },
+ }
+
+ local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+
+ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
+ group = lint_augroup,
+ callback = function()
+ lint.try_lint(nil, { ignore_errors = true })
+ end,
+ })
+
+ vim.api.nvim_create_autocmd({ "InsertLeave" }, {
+ group = lint_augroup,
+ callback = function()
+ if vim.bo.filetype ~= "rust" then
+ lint.try_lint(nil, { ignore_errors = true })
+ end
+ end,
+ })
+ end,
+ },
+}