From 5ed1bc38dc6467a2e69e3b6ad04f9b92f3ca882f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20NICOLAS?= Date: Wed, 30 Oct 2024 16:41:46 +0100 Subject: [PATCH] Disable linting autocmd for readonly buffers (#1202) * Disable linting autocmd for readonly buffers This should avoid linting in buffers outside of the user's control, having in mind especially the handy LSP pop-ups that describe your hovered symbol using markdown. Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> * Justify guarding try_lint in readonly buffers Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> --------- Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> --- lua/kickstart/plugins/lint.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index ca9bc23..907c6bf 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -47,7 +47,12 @@ return { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { group = lint_augroup, callback = function() - lint.try_lint() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end end, }) end,