Set a limit to how wide the completion menu can be
This commit is contained in:
parent
63d2a3ffd3
commit
09c785eee9
@ -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(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user