My neovim details:
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
OS details (if useful)
WSL2
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Also, I am using nvchad with lazyvim
What I want to do:
-
Disable the virtual text that shows against code lines, when there any error/warning/info.
-
I want to disable the virtual text and have it shown in a hover window on click of some keys (g + l)
What I did to achieve this but not working..
- I have configured this in my
~/.config/nvim/init.lua
vim.diagnostic.config({
signs = true,
underline = true,
update_in_insert = false,
virtual_text = false,
severity_sort = true,
})
- Also added entries into
~/.config/nvim/lua/configs/lspconfig.lua
like below..
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "html", "cssls", "rust_analyzer" }
local nvlsp = require "nvchad.configs.lspconfig"
-- Define custom LSP options
local custom_opts = {
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = false,
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
},
inlay_hints = {
enabled = true,
exclude = { "vue" },
},
document_highlight = {
enabled = true,
},
capabilities = nvlsp.capabilities,
}
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
capabilities = custom_opts.capabilities,
settings = custom_opts,
}
end
But with no luck. The errors are shown inline. Any help is highly appreciated.