fix: correct mapping for snippet insertion in completion

This commit is contained in:
2024-12-18 14:24:34 -05:00
parent d2bda27817
commit 00a78e028b
+15 -4
View File
@@ -22,6 +22,7 @@ local function cmp_provider(performance)
} }
end end
end end
local cmp_repo = cmp_provider(perf) local cmp_repo = cmp_provider(perf)
if vim.g.useblinkcmp then if vim.g.useblinkcmp then
@@ -40,8 +41,13 @@ if vim.g.useblinkcmp then
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-e>'] = { 'hide', 'fallback' }, ['<C-e>'] = { 'hide', 'fallback' },
['<C-y>'] = {
LazyVim.cmp.map({ 'select_and_accept', 'ai_accept' }),
'fallback',
},
['<Tab>'] = { ['<Tab>'] = {
LazyVim.cmp.map({ 'snippet_forward', 'ai_accept' }), 'snippet_forward',
'fallback', 'fallback',
}, },
['<S-Tab>'] = { 'snippet_backward', 'fallback' }, ['<S-Tab>'] = { 'snippet_backward', 'fallback' },
@@ -76,7 +82,9 @@ if vim.g.useblinkcmp then
end end
-- Else use classic cmp -- Else use classic cmp
return { -- cmp return {
{ import = 'lazyvim.plugins.extras.coding.nvim-cmp' },
{ -- cmp
url = cmp_repo.url, url = cmp_repo.url,
build = cmp_repo.build, build = cmp_repo.build,
branch = cmp_repo.branch, branch = cmp_repo.branch,
@@ -198,8 +206,10 @@ return { -- cmp
dotenv = ' Dotenv', dotenv = ' Dotenv',
cmp_yanky = '󰅍 Yanked', cmp_yanky = '󰅍 Yanked',
} }
local color_item = local color_item = require('nvim-highlight-colors').format(
require('nvim-highlight-colors').format(entry, { kind = item.kind }) entry,
{ kind = item.kind }
)
item = require('lspkind').cmp_format({ item = require('lspkind').cmp_format({
require('tailwind-tools.cmp').lspkind_format, require('tailwind-tools.cmp').lspkind_format,
})(entry, item) })(entry, item)
@@ -258,4 +268,5 @@ return { -- cmp
}) })
end end
end, end,
},
} }