fix(nvim): update nvim_cmp config

This commit is contained in:
Rob Watson 2023-09-21 16:00:41 +02:00
parent e58d133058
commit 711d82fc2b
1 changed files with 15 additions and 7 deletions

View File

@ -1,15 +1,20 @@
local cmp = require("cmp")
local cmp_buffer = require("cmp_buffer")
-- local cmp_buffer = require("cmp_buffer")
cmp.setup({
completion = {
completeopt = "menu,menuone,noinsert",
completeopt = "menu,menuone,noinsert,noselect",
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
preselect = cmp.PreselectMode.None,
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
@ -34,13 +39,16 @@ cmp.setup({
}),
sorting = {
comparators = {
function(...)
return cmp_buffer:compare_locality(...)
end,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
-- require("cmp-under-comparator").under,
cmp.config.compare.kind,
},
},
view = {
entries = "native",
formatting = {
fields = { "kind", "abbr", "menu" },
},
experimental = {
ghost_text = true,