fix annoying cmp

This commit is contained in:
Volodymyr Patuta 2023-01-23 18:56:51 +01:00
parent be2a169edc
commit 72db99ff26
1 changed files with 3 additions and 30 deletions

View File

@ -100,7 +100,7 @@ function M.config()
else else
fallback() fallback()
end end
end, { 'i', 'c', 's' }), end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback) ['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
@ -110,7 +110,7 @@ function M.config()
else else
fallback() fallback()
end end
end, { 'i', 's', 'c' }), end, { 'i', 's' }),
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
@ -121,33 +121,7 @@ function M.config()
}, },
} }
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = { mapping = cmp.mapping.preset.cmdline(),
['<TAB>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
else
cmp.complete()
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
end
end, { 'i', 's', 'c' }),
['<S-TAB>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item { behavior = cmp.SelectBehavior.Insert }
else
cmp.complete()
end
end, { 'i', 's', 'c' }),
['<CR>'] = cmp.mapping {
i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false },
c = function(fallback)
if cmp.visible() then
cmp.confirm { behavior = cmp.ConfirmBehavior.Insert, select = true }
else
fallback()
end
end,
},
},
sources = { sources = {
{ name = 'cmdline' }, { name = 'cmdline' },
{ name = 'path' }, { name = 'path' },
@ -159,7 +133,6 @@ function M.config()
}) })
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
completion = { autocomplete = true },
sources = { sources = {
{ name = 'buffer' }, { name = 'buffer' },
}, },