feat(nvim-cmp.lua): add custom border function to define border characters for completion and documentation windows

feat(nvim-cmp.lua): configure window settings for completion and documentation windows to improve visual appearance and readability
This commit is contained in:
David Ibia
2024-07-30 23:22:14 +01:00
parent 5631e845d1
commit 43c3a7ce37

View File

@@ -5,10 +5,34 @@ local lspkind = require("lspkind")
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load()
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
cmp.setup({
completion = {
completeopt = "menu,menuone,preview,noselect",
},
window = {
completion = {
side_padding = 1,
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
scrollbar = false,
},
documentation = {
border = border "CmpDocBorder",
winhighlight = "Normal:CmpDoc",
},
},
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)