summaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorBrahmajit Das <listout@listout.xyz>2026-02-06 01:03:46 +0000
committerBrahmajit Das <listout@listout.xyz>2026-02-06 01:03:46 +0000
commitcd33fbfe915d2f9f86d9e6206105a1766649de1e (patch)
treeb4665afcc91c87a9da29e8c31f610bdbe9065de5 /lua/plugins
parentb8f06039bde7cad5310362b8eb7debf216cbbb05 (diff)
downloadnvim-cd33fbfe915d2f9f86d9e6206105a1766649de1e.tar.gz
lua: plugins: completion: lspkind configuration
Signed-off-by: Brahmajit Das <listout@listout.xyz>
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/completion.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua
index 0fec879..5b45c39 100644
--- a/lua/plugins/completion.lua
+++ b/lua/plugins/completion.lua
@@ -30,6 +30,27 @@ return {
local lspkind = require('lspkind')
cmp.setup {
+ formatting = {
+ fields = { 'abbr', 'icon', 'kind', 'menu' },
+ format = lspkind.cmp_format({
+ maxwidth = {
+ -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
+ -- can also be a function to dynamically calculate max width such as
+ -- menu = function() return math.floor(0.45 * vim.o.columns) end,
+ menu = 70, -- leading text (labelDetails)
+ abbr = 70, -- actual suggestion item
+ },
+ ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
+ show_labelDetails = true, -- show labelDetails in menu. Disabled by default
+
+ -- The function below will be called before any actual modifications from lspkind
+ -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
+ before = function(entry, vim_item)
+ -- ...
+ return vim_item
+ end
+ })
+ },
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.