Skip to content

Commit

Permalink
Disable linting autocmd for readonly buffers (#1202)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Justify guarding try_lint in readonly buffers

Co-authored-by: Robin Gruyters <[email protected]>

---------

Co-authored-by: Robin Gruyters <[email protected]>
  • Loading branch information
ccjmne and rgruyters authored Oct 30, 2024
1 parent 4120893 commit 5ed1bc3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/kickstart/plugins/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5ed1bc3

Please sign in to comment.