Skip to content

Fields and wide menu #1 #890

Answered by fitrh
gegoune asked this question in Q&A
Apr 12, 2022 · 2 comments · 1 reply
Discussion options

You must be logged in to vote
  formatting = {
    fields = { cmp.ItemField.Abbr, cmp.ItemField.Menu },
    format = function(entry, vim_item)
      vim_item.menu = ' '
        .. (({ nvim_lsp = 'lsp', cmp_git = 'git' })[entry.source.name] or entry.source.name)
        .. ': '
        .. vim_item.kind

      return vim_item
    end,
  },

For this code to work as expected, the vim_item.kind need to set to nil

  formatting = {
    fields = { cmp.ItemField.Abbr, cmp.ItemField.Menu },
    format = function(entry, vim_item)
      vim_item.menu = ' '
        .. (({ nvim_lsp = 'lsp', cmp_git = 'git' })[entry.source.name] or entry.source.name)
        .. ': '
        .. vim_item.kind
+     vim_item.kind = nil
      return vim…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gegoune
Comment options

Answer selected by gegoune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants