feat(plugin): Add nvim-aputopairs, use symbols in cmp

This commit is contained in:
Jiří Štefka 2024-09-20 15:46:27 +02:00
parent e6c9d72c3f
commit 3777f30d68
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE
3 changed files with 10 additions and 1 deletions
nvim/plugin

View file

@ -4,6 +4,7 @@ end
vim.g.did_load_completion_plugin = true
local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local lspkind = require('lspkind')
local luasnip = require('luasnip')
@ -31,10 +32,12 @@ cmp.setup {
},
formatting = {
format = lspkind.cmp_format {
mode = 'symbol_text',
-- mode = 'symbol_text',
mode = 'symbol',
with_text = true,
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
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
menu = {
buffer = '[BUF]',
@ -52,6 +55,10 @@ cmp.setup {
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
-- cmp.event:on(
-- 'confirm_done',
-- cmp_autopairs.on_confirm_done()
-- ),
mapping = {
['<C-b>'] = cmp.mapping(function(_)
if cmp.visible() then