From 972e5f9c68cc433c5fc26adf92cd25b293a3776a Mon Sep 17 00:00:00 2001 From: brustybee Date: Mon, 9 Mar 2026 17:02:03 +0530 Subject: One shot upload --- lua/plugins/linter.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lua/plugins/linter.lua (limited to 'lua/plugins/linter.lua') 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, + }, +} -- cgit v1.3.1