vim: remove cmdline completion

This commit is contained in:
Fernando Schauenburg 2023-07-09 13:45:41 +02:00
parent 5b65da08f2
commit 90d7f05e4b

View file

@ -1,50 +1,48 @@
local config = function() local config = function()
local cmp = require('cmp') local cmp = require('cmp')
local mapping = function(mode) local mapping = {
return { ['<c-n>'] = {
['<c-n>'] = { i = function()
[mode] = function() if cmp.visible() then
if cmp.visible() then cmp.select_next_item { behavior = cmp.SelectBehavior.Select }
cmp.select_next_item { behavior = cmp.SelectBehavior.Select } else
else cmp.complete()
cmp.complete() end
end end,
end, },
},
['<c-p>'] = { ['<c-p>'] = {
[mode] = function() i = function()
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item { behavior = cmp.SelectBehavior.Select } cmp.select_prev_item { behavior = cmp.SelectBehavior.Select }
else else
cmp.complete() cmp.complete()
end end
end, end,
}, },
['<Down>'] = { [mode] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select } }, ['<Down>'] = { i = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select } },
['<Up>'] = { [mode] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select } }, ['<Up>'] = { i = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select } },
['<c-f>'] = { [mode] = cmp.mapping.scroll_docs(4) }, ['<c-f>'] = { i = cmp.mapping.scroll_docs(4) },
['<c-b>'] = { [mode] = cmp.mapping.scroll_docs(-4) }, ['<c-b>'] = { i = cmp.mapping.scroll_docs(-4) },
['<c-e>'] = { [mode] = cmp.mapping.abort() }, ['<c-e>'] = { i = cmp.mapping.abort() },
['<c-y>'] = { [mode] = cmp.mapping.confirm { select = true } }, ['<c-y>'] = { i = cmp.mapping.confirm { select = true } },
['<Tab>'] = { ['<Tab>'] = {
[mode] = function(fallback) i = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.confirm { select = true } cmp.confirm { select = true }
else else
fallback() fallback()
end end
end, end,
}, },
} }
end
cmp.setup { cmp.setup {
mapping = mapping('i'), mapping = mapping,
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
@ -74,15 +72,6 @@ local config = function()
ghost_text = true, ghost_text = true,
}, },
} }
cmp.setup.cmdline(':', {
mapping = mapping('c'),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end end
return { return {