This commit is contained in:
Ray Elliott 2025-12-06 21:16:25 +00:00
commit ed3cabf8b0
6 changed files with 119 additions and 8 deletions

39
lua/plugins/cmp.lua Normal file
View file

@ -0,0 +1,39 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"L3MON4D3/LuaSnip",
},
opts = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
return {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-e>"] = cmp.mapping.abort(),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "buffer" },
}),
completion = { completeopt = "menu,menuone,noselect" },
}
end,
config = function(_, opts)
require("cmp").setup(opts)
end,
}