-
How do I unmap local cmp = require("cmp")
local luasnip = require("luasnip")
return {
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
end,
keys = {
{
"<Tab>",
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
desc = "Tab Complete",
},
{
"<S-Tab>",
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
desc = "Tab Complete",
},
},
},
} |
Beta Was this translation helpful? Give feedback.
Answered by
ipatch
Jul 28, 2023
Replies: 1 comment
-
i setup this plugin differently than your example above but i have the below snippet in my init.lua local cmp = require('cmp')
cmp.setup({
sources = {
{name = 'path'},
{name = 'nvim_lsp'},
{name = 'nvim_lua'},
},
mapping = {
-- use `TAB` key to highlight next item in list
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- ['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace }),
},
} you can check out my entire init.lua here it changes a lot so i'll include the permalink. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
txtyash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i setup this plugin differently than your example above but i have the below snippet in my init.lua
you can check out my entire init.lua here it changes a lot so i'll include the permalink.