Changing several settings for nvim-cmp based upon the recommended
settings for the plugin.
This commit is contained in:
parent
1de6c86595
commit
329df1a121
24
init.lua
24
init.lua
@ -525,7 +525,7 @@ if cmp then
|
|||||||
end
|
end
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = 'menu,menuone,noinsert' -- TODO: Necessary copy of the default completeopt?
|
completeopt = 'menu,menuone,noselect' -- TODO: Necessary copy of the default completeopt?
|
||||||
},
|
},
|
||||||
experimental = {
|
experimental = {
|
||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
@ -547,34 +547,34 @@ if cmp then
|
|||||||
-- vim_item.kind = string.format('%s', vim_item.kind)
|
-- vim_item.kind = string.format('%s', vim_item.kind)
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
buffer = '[Buf]',
|
buffer = '[Buf]',
|
||||||
nvim_lsp = '[LSP]',
|
|
||||||
luasnip = '[Snips]',
|
luasnip = '[Snips]',
|
||||||
|
nvim_lsp = '[LSP]',
|
||||||
nvim_lua = '[Lua]'
|
nvim_lua = '[Lua]'
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
fields = { 'abbr', 'kind', 'menu' }
|
fields = { 'abbr', 'kind', 'menu' }
|
||||||
},
|
},
|
||||||
sources = {
|
sources = cmp.config.sources({
|
||||||
-- NOTE: the order of sources determines their loading priority in the autocomplete menu
|
-- NOTE: the order of sources determines their loading priority in the autocomplete menu
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'buffer', keyword_length = 2 },
|
}, {
|
||||||
},
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable the ':' character for the vim commandline completion, eg. for nvim commands
|
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = cmp.config.sources({
|
||||||
{ name = 'path' },
|
{ name = 'path' }
|
||||||
{ name = 'cmdline', keyword_length = 2 }
|
}, {
|
||||||
}
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Enable the '/' and '?' character for the completion of in buffer elements only to autocomplete the search command
|
cmp.setup.cmdline('/', {
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'buffer' }
|
{ name = 'buffer' }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user