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