elas-arch-config/nvim/.config/nvim/lua/plugins/completion.lua
2024-07-22 22:18:54 +02:00

38 lines
1.1 KiB
Lua

return {
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
"onsails/lspkind-nvim",
},
config = function()
local cmp = require("cmp")
local sources = {
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "buffer" },
}
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = sources,
formatting = { format = require("lspkind").cmp_format() },
})
end,
},
}