You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently followed the instructions on this website nvim-cmp wiki to setup the menu appearance. I managed to obtain the expected result but for some reason double-width glyphs are not displayed correctly:
For a moment I thought that those icons required an extra space, so I declared a kind_icons variable to which I assigned the value of the icons with their respective space but the following happened (Incomplete double-width glyphs and empty () ):
This happens even to the cmp-calc source:
Here is the code:
{
"nvim-cmp",
dependencies= {
"onsails/lspkind-nvim",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"f3fora/cmp-spell",
},
opts=function(_, opts)
opts.sources= {
{ name="nvim_lsp" },
{ name="luasnip" },
{ name="path" },
{ name="nvim_lua" },
{ name="calc" },
{ name="emoji" },
{ name="spell", keyword_length=4 },
}
opts.window= {
completion= {
winhighlight="Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset=-3,
side_padding=0,
},
documentation=require("cmp").config.window.bordered({
winhighlight="Normal:FloatBorder,FloatBorder:FloatBorder,Search:None",
}),
}
opts.formatting= {
fields= { "kind", "abbr", "menu" },
format=function(entry, vim_item)
-- This is the kind_icons variable I was talking about earlier.localkind_icons= {
Text=" ",
Method=" ",
Function="",
Constructor=" ",
Field=" ",
Variable="",
Class=" ",
Interface=" ",
Module=" ",
Property=" ",
Unit=" ",
Value=" ",
Enum=" ",
Keyword=" ",
Snippet=" ",
Color=" ",
File=" ",
Reference=" ",
Folder=" ",
EnumMember=" ",
Constant="",
Struct=" ",
Event=" ",
Operator=" ",
TypeParameter="",
}
localkind=require("lspkind").cmp_format({
-- To use the default icons provided by lspkind, you can comment the following line:symbol_map=kind_icons,
mode="symbol_text",
maxwidth=50, -- I also tried to modify this value but nothing changes
})(entry, vim_item)
localcustom_menu_icon= {
calc="",
}
ifentry.source.name=="calc" thenvim_item.kind=custom_menu_icon.calcendlocalstrings=vim.split(kind.kind, "%s", { trimempty=true })
kind.kind="" .. (strings[1] or"") ..""kind.menu="(" .. (strings[2] or"") ..")"returnkindend,
}
end,
},
I don't know if it's necessary to specify but... I'm using:
Regular hack nerd font (HackNerdFont-Regular.ttf)
NVIM v0.9.5
LazyVim version 11.4.1
I performed a small test by changing to Hack monospaced font (HackNerdFontMono-Regular.ttf) and it works fine but now icons looked really small (Is not a big problem but it would be nice to have large icons):
This is how it looks without monospace font:
At the moment I am in the debate of finding out how to change the size of the completion window or the size of the icons or give up and use the monospace font.
I'll stay tuned in case more information is required.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
I recently followed the instructions on this website nvim-cmp wiki to setup the menu appearance. I managed to obtain the expected result but for some reason double-width glyphs are not displayed correctly:
For a moment I thought that those icons required an extra space, so I declared a kind_icons variable to which I assigned the value of the icons with their respective space but the following happened (Incomplete double-width glyphs and empty () ):
This happens even to the cmp-calc source:
Here is the code:
I don't know if it's necessary to specify but... I'm using:
I performed a small test by changing to Hack monospaced font (HackNerdFontMono-Regular.ttf) and it works fine but now icons looked really small (Is not a big problem but it would be nice to have large icons):
This is how it looks without monospace font:
At the moment I am in the debate of finding out how to change the size of the completion window or the size of the icons or give up and use the monospace font.
I'll stay tuned in case more information is required.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions