♻️ refactor(lint): trigger linting on cursor hold and always include cspell
This commit is contained in:
2 files changed
+14
-5
No files matched your search
@@ -16,9 +16,6 @@ treesitter.setup({
|
||||
textobjects = textobjects,
|
||||
matchup = { enable = true },
|
||||
indent = { enable = true },
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user