From 43c3a7ce37482e1de5bfdaadb0b86c2464fd24e0 Mon Sep 17 00:00:00 2001 From: David Ibia Date: Tue, 30 Jul 2024 23:22:14 +0100 Subject: [PATCH] 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 --- lua/absolute/after/nvim-cmp.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lua/absolute/after/nvim-cmp.lua b/lua/absolute/after/nvim-cmp.lua index 0456f8a..da842df 100644 --- a/lua/absolute/after/nvim-cmp.lua +++ b/lua/absolute/after/nvim-cmp.lua @@ -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)