53 lines
1.2 KiB
Lua
53 lines
1.2 KiB
Lua
vim.opt.completeopt = { "menuone", "noselect" }
|
|
|
|
local cmp = require("cmp")
|
|
local neogen = require("neogen")
|
|
|
|
cmp.setup({
|
|
snippet = {
|
|
expand = function(args)
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
end,
|
|
},
|
|
mapping = {
|
|
-- ['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
-- ['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
["<C-e>"] = cmp.mapping.close(),
|
|
["<CR>"] = cmp.mapping.confirm({
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = false,
|
|
}),
|
|
["<tab>"] = cmp.mapping(function(fallback)
|
|
if neogen.jumpable() then
|
|
neogen.jump_next()
|
|
else
|
|
fallback()
|
|
end
|
|
end, {
|
|
"i",
|
|
"s",
|
|
}),
|
|
["<S-tab>"] = cmp.mapping(function(fallback)
|
|
if neogen.jumpable(true) then
|
|
neogen.jump_prev()
|
|
else
|
|
fallback()
|
|
end
|
|
end, {
|
|
"i",
|
|
"s",
|
|
}),
|
|
},
|
|
sources = {
|
|
{ name = "nvim_lsp" },
|
|
{ name = "nvim_lsp_signature_help" },
|
|
{ name = "path" },
|
|
{ name = "buffer", keyword_length = 5 },
|
|
{ name = "vsnip" },
|
|
{ name = "orgmode" },
|
|
},
|
|
})
|