Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup cmp window, item.abbr maxwidth and minwidth #361

Open
wants to merge 8 commits into
base: v3.0
Choose a base branch
from
7 changes: 7 additions & 0 deletions lua/nvchad/cmp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local format_kk = require "nvchad.cmp.format"
local atom_styled = cmp_style == "atom" or cmp_style == "atom_colored"
local fields = (atom_styled or cmp_ui.icons_left) and { "kind", "abbr", "menu" } or { "abbr", "kind", "menu" }

local abbr_maxwidth = cmp_ui.abbr_maxwidth or 60

local M = {
formatting = {
format = function(entry, item)
Expand All @@ -24,6 +26,11 @@ local M = {
format_kk.tailwind(entry, item)
end

-- item.abbr maxwidth
if #item.abbr > abbr_maxwidth then
item.abbr = string.sub(item.abbr, 1, abbr_maxwidth) .. '…'
end

return item
end,

Expand Down