如何禁用cmp插件自动补全列表中的代码描述?
移除NvChad中nvim-cmp代码描述弹窗的解决办法
- 定位到NvChad自定义配置里的cmp配置文件,通常路径是
custom/plugins/configs/cmp.lua - 在
cmp.setup()的配置块中添加或修改window选项,关闭文档预览窗口:
cmp.setup({ -- 保留你原有其他配置 window = { documentation = false, -- 直接关闭补全时弹出的代码描述窗口 -- 要是想保留功能但隐藏窗口,可替换为以下配置: -- documentation = { -- max_height = 0, -- max_width = 0, -- } }, -- 保留你原有其他配置 })
- 保存配置后重启Neovim,即可移除干扰你的黄色标注代码描述。
如果以上方法没效果,有可能是LSP的inlay hints导致的,可在LSP配置中关闭:
-- 在custom/plugins/configs/lspconfig.lua的on_attach函数中添加 local on_attach = function(client, bufnr) -- 保留原有其他on_attach配置 client.server_capabilities.inlayHintProvider = false end
内容的提问来源于stack exchange,提问作者DrShahinstein
相关产品推荐
相关产品推荐

