From 854534f54c302e4c88e2c23908a7ced6f6b65b16 Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 3 May 2022 22:57:16 +0530 Subject: [PATCH] rice cmp-nvim related to https://github.com/NvChad/base46/commit/15a1b910a0ebe297cac5466c77b2b73f2aa68f8b --- lua/plugins/configs/cmp.lua | 35 +++++++++++++++++++++------ lua/plugins/configs/lspkind_icons.lua | 2 +- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/lua/plugins/configs/cmp.lua b/lua/plugins/configs/cmp.lua index 4832b18..dca01c5 100644 --- a/lua/plugins/configs/cmp.lua +++ b/lua/plugins/configs/cmp.lua @@ -6,23 +6,44 @@ end vim.opt.completeopt = "menuone,noselect" +local function border(hl_name) + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } +end + +local cmp_window = require "cmp.utils.window" + +function cmp_window:has_scrollbar() + return false +end + local options = { + window = { + completion = { + border = border "CmpBorder", + }, + documentation = { + border = border "CmpDocBorder", + }, + }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, formatting = { - format = function(entry, vim_item) + format = function(_, vim_item) local icons = require "plugins.configs.lspkind_icons" vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) - vim_item.menu = ({ - nvim_lsp = "[LSP]", - nvim_lua = "[Lua]", - buffer = "[BUF]", - })[entry.source.name] - return vim_item end, }, diff --git a/lua/plugins/configs/lspkind_icons.lua b/lua/plugins/configs/lspkind_icons.lua index 2d538a7..bf5af7a 100644 --- a/lua/plugins/configs/lspkind_icons.lua +++ b/lua/plugins/configs/lspkind_icons.lua @@ -1,7 +1,7 @@ local icons = { Text = "", Method = "", - Function = "", + Function = "", Constructor = "", Field = "ﰠ", Variable = "",