♻️ refactor(lint): trigger linting on cursor hold and always include cspell

This commit is contained in:
sankalp committed 2025-07-25 14:40:42 +05:45
1 parent 54e8df575f
commit a473b50c4c
2 files changed
+14 -5

No files matched your search

-3
View File
@@ -16,9 +16,6 @@ treesitter.setup({
textobjects = textobjects,
matchup = { enable = true },
indent = { enable = true },
autotag = {
enable = true,
},
highlight = {
enable = true,
+14 -2
View File
@@ -15,9 +15,21 @@ lint.linters_by_ft = {
}
-- Trigger linting on save and buffer events
vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufReadPost', 'InsertLeave' }, {
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
callback = function()
lint.try_lint()
local lint = require('lint')
-- Get the filetype-specific linters
local ft = vim.bo.filetype
local linters = lint.linters_by_ft[ft] or {}
-- Add cspell if it's not already included
if not vim.tbl_contains(linters, 'cspell') then
table.insert(linters, 'cspell')
end
-- Run them all
lint.try_lint(linters)
end,
})