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>
This commit is contained in:
		
							parent
							
								
									4120893b8a
								
							
						
					
					
						commit
						5ed1bc38dc
					
				| 
						 | 
					@ -47,7 +47,12 @@ return {
 | 
				
			||||||
      vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
 | 
					      vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
 | 
				
			||||||
        group = lint_augroup,
 | 
					        group = lint_augroup,
 | 
				
			||||||
        callback = function()
 | 
					        callback = function()
 | 
				
			||||||
 | 
					          -- 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()
 | 
					            lint.try_lint()
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
        end,
 | 
					        end,
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    end,
 | 
					    end,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue