Skip to content

Commit

Permalink
feat: removed diagnostics when in visual mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rachartier committed Aug 9, 2024
1 parent ce1fa56 commit aa3d01c
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions lua/tiny-inline-diagnostic/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,6 @@ function M.set_diagnostic_autocmds(opts)
end,
})

vim.api.nvim_create_autocmd("InsertEnter", {
group = autocmd_ns,
buffer = event.buf,
callback = function()
if vim.api.nvim_buf_is_valid(event.buf) then
extmarks.clear(event.buf)
end
end,
})

vim.api.nvim_create_autocmd("CursorHold", {
group = autocmd_ns,
buffer = event.buf,
Expand Down Expand Up @@ -223,6 +213,27 @@ function M.set_diagnostic_autocmds(opts)
end,
desc = "Show diagnostics on cursor move, throttled.",
})

vim.api.nvim_create_autocmd("ModeChanged", {
group = autocmd_ns,
pattern = "*:[vV\x16is]*",
callback = function()
if vim.api.nvim_buf_is_valid(event.buf) then
M.disable()
extmarks.clear(event.buf)
end
end,
})

vim.api.nvim_create_autocmd("ModeChanged", {
group = autocmd_ns,
pattern = "[vV\x16is]*:*",
callback = function()
if vim.api.nvim_buf_is_valid(event.buf) then
M.enable()
end
end,
})
end,
desc = "Apply autocmds for diagnostics on cursor move and window resize events.",
})
Expand Down

0 comments on commit aa3d01c

Please sign in to comment.