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,10 +1,9 @@
local config = function()
local cmp = require('cmp')
local mapping = function(mode)
return {
local mapping = {
['<c-n>'] = {
[mode] = function()
i = function()
if cmp.visible() then
cmp.select_next_item { behavior = cmp.SelectBehavior.Select }
else
@ -14,7 +13,7 @@ local config = function()
},
['<c-p>'] = {
[mode] = function()
i = function()
if cmp.visible() then
cmp.select_prev_item { behavior = cmp.SelectBehavior.Select }
else
@ -23,16 +22,16 @@ local config = function()
end,
},
['<Down>'] = { [mode] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select } },
['<Up>'] = { [mode] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select } },
['<Down>'] = { i = cmp.mapping.select_next_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-b>'] = { [mode] = cmp.mapping.scroll_docs(-4) },
['<c-f>'] = { i = cmp.mapping.scroll_docs(4) },
['<c-b>'] = { i = cmp.mapping.scroll_docs(-4) },
['<c-e>'] = { [mode] = cmp.mapping.abort() },
['<c-y>'] = { [mode] = cmp.mapping.confirm { select = true } },
['<c-e>'] = { i = cmp.mapping.abort() },
['<c-y>'] = { i = cmp.mapping.confirm { select = true } },
['<Tab>'] = {
[mode] = function(fallback)
i = function(fallback)
if cmp.visible() then
cmp.confirm { select = true }
else
@ -41,10 +40,9 @@ local config = function()
end,
},
}
end
cmp.setup {
mapping = mapping('i'),
mapping = mapping,
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
@ -74,15 +72,6 @@ local config = function()
ghost_text = true,
},
}
cmp.setup.cmdline(':', {
mapping = mapping('c'),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end
return {