diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index cb75d7d..0670395 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -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, }, }) +