nvim: Hide virtual-text diagnostics on insert
When writing something we often want to ideally hide the long comments added to the end of any line in-progress as virtual text currently. This simply adds an auto-command to hide when entering and show again when exiting insert mode, simple but hopefully useful.
This commit is contained in:
parent
c3fe4cdc58
commit
b45296765a
1 changed files with 6 additions and 0 deletions
|
@ -122,6 +122,11 @@ local function on_attach(client, bufnr)
|
|||
end
|
||||
end
|
||||
|
||||
-- Display diagnostics as virtual text only if not in insert mode
|
||||
-- https://lr.artemislena.eu/r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/
|
||||
vim.api.nvim_create_autocmd("InsertEnter", { callback = function() vim.diagnostic.config({ virtual_text = false, }) end })
|
||||
vim.api.nvim_create_autocmd("InsertLeave", { callback = function() vim.diagnostic.config({ virtual_text = true, }) end })
|
||||
|
||||
lsp.setup({
|
||||
default_mappings = false,
|
||||
servers = servers,
|
||||
|
@ -203,3 +208,4 @@ require("mason-null-ls").setup({
|
|||
end,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue