diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index 434748a..d12c27b 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -139,6 +139,20 @@ return { { name = 'git' }, }, + formatting = { + format = function(entry, vim_item) + -- Set a limit to how wide the completion menu can be + local winwidth = vim.fn.winwidth(vim.api.nvim_get_current_win()) + local menuwidth = math.min(winwidth / 2, 70) + if menuwidth < 70 then + vim_item.menu = '' + vim_item.kind = '' + end + vim_item.abbr = string.sub(vim_item.abbr, 1, menuwidth) + return vim_item + end + }, + window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),